(x: ArgIntoFloat, vm: &VirtualMachine)
| 172 | |
| 173 | #[pyfunction] |
| 174 | fn sqrt(x: ArgIntoFloat, vm: &VirtualMachine) -> PyResult<f64> { |
| 175 | let val = x.into_float(); |
| 176 | pymath::math::sqrt(val).map_err(|err| match err { |
| 177 | pymath::Error::EDOM => vm.new_value_error(format!( |
| 178 | "expected a nonnegative input, got {}", |
| 179 | super::float_repr(val) |
| 180 | )), |
| 181 | _ => pymath_exception(err, vm), |
| 182 | }) |
| 183 | } |
| 184 | |
| 185 | // Trigonometric functions: |
| 186 | #[pyfunction] |