diff --git a/stdlib/src/math.rs b/stdlib/src/math.rs index 889cd1671..7c51f0d73 100644 --- a/stdlib/src/math.rs +++ b/stdlib/src/math.rs @@ -166,7 +166,12 @@ mod math { #[pyfunction] fn log10(x: ArgIntoFloat, vm: &VirtualMachine) -> PyResult { - call_math_func!(log10, x, vm) + let x = x.to_f64(); + if x.is_nan() || x > 0.0_f64 { + Ok(x.log10()) + } else { + Err(vm.new_value_error("math domain error".to_owned())) + } } #[pyfunction]