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

Function isclose

crates/stdlib/src/cmath.rs:161–169  ·  view source on GitHub ↗
(args: IsCloseArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

159
160 #[pyfunction]
161 fn isclose(args: IsCloseArgs, vm: &VirtualMachine) -> PyResult<bool> {
162 let a = args.a.into_complex();
163 let b = args.b.into_complex();
164 let rel_tol = args.rel_tol.into_option().map(|v| v.into_float());
165 let abs_tol = args.abs_tol.into_option().map(|v| v.into_float());
166
167 pymath::cmath::isclose(a, b, rel_tol, abs_tol)
168 .map_err(|_| vm.new_value_error("tolerances must be non-negative"))
169 }
170}

Callers

nothing calls this directly

Calls 4

into_complexMethod · 0.80
into_optionMethod · 0.80
into_floatMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected