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

Function isclose

crates/stdlib/src/math.rs:61–69  ·  view source on GitHub ↗
(args: IsCloseArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

59
60 #[pyfunction]
61 fn isclose(args: IsCloseArgs, vm: &VirtualMachine) -> PyResult<bool> {
62 let a = args.a.into_float();
63 let b = args.b.into_float();
64 let rel_tol = args.rel_tol.into_option().map(|v| v.into_float());
65 let abs_tol = args.abs_tol.into_option().map(|v| v.into_float());
66
67 pymath::math::isclose(a, b, rel_tol, abs_tol)
68 .map_err(|_| vm.new_value_error("tolerances must be non-negative"))
69 }
70
71 #[pyfunction]
72 fn copysign(x: ArgIntoFloat, y: ArgIntoFloat, vm: &VirtualMachine) -> PyResult<f64> {

Callers 3

assertIsCloseFunction · 0.50
assertIsNotCloseFunction · 0.50
stdlib_math.pyFile · 0.50

Calls 3

into_floatMethod · 0.80
into_optionMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected