(x: PyObjectRef, vm: &VirtualMachine)
| 148 | |
| 149 | #[pyfunction] |
| 150 | fn log10(x: PyObjectRef, vm: &VirtualMachine) -> PyResult<f64> { |
| 151 | // Handle BigInt specially for large values (only for actual int type, not float) |
| 152 | if let Some(i) = x.downcast_ref::<PyInt>() { |
| 153 | return pymath::math::log10_bigint(i.as_bigint()).map_err(|err| match err { |
| 154 | pymath::Error::EDOM => vm.new_value_error("expected a positive input"), |
| 155 | _ => pymath_exception(err, vm), |
| 156 | }); |
| 157 | } |
| 158 | let val = x.try_float(vm)?.to_f64(); |
| 159 | pymath::math::log10(val).map_err(|err| match err { |
| 160 | pymath::Error::EDOM => vm.new_value_error(format!( |
| 161 | "expected a positive input, got {}", |
| 162 | super::float_repr(val) |
| 163 | )), |
| 164 | _ => pymath_exception(err, vm), |
| 165 | }) |
| 166 | } |
| 167 | |
| 168 | #[pyfunction] |
| 169 | fn pow(x: ArgIntoFloat, y: ArgIntoFloat, vm: &VirtualMachine) -> PyResult<f64> { |
nothing calls this directly
no test coverage detected