MCPcopy Index your code
hub / github.com/RustPython/RustPython / cos

Function cos

crates/stdlib/src/math.rs:221–229  ·  view source on GitHub ↗
(x: ArgIntoFloat, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

219
220 #[pyfunction]
221 fn cos(x: ArgIntoFloat, vm: &VirtualMachine) -> PyResult<f64> {
222 let val = x.into_float();
223 pymath::math::cos(val).map_err(|err| match err {
224 pymath::Error::EDOM => {
225 vm.new_value_error(format!("expected a finite input, got {}", float_repr(val)))
226 }
227 _ => pymath_exception(err, vm),
228 })
229 }
230
231 #[pyfunction]
232 fn hypot(coordinates: PosArgs<ArgIntoFloat>) -> f64 {

Callers 2

parabolic_kernelFunction · 0.90
cosine_kernelFunction · 0.90

Calls 2

pymath_exceptionFunction · 0.85
into_floatMethod · 0.80

Tested by

no test coverage detected