MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / float_eq

Function float_eq

01_numbers/rust/cast.rs:37–39  ·  view source on GitHub ↗

float equality (hack! - does not handle NaN/Infinity, see https://floating-point-gui.de/errors/comparison/)

(a: f32, b: f32)

Source from the content-addressed store, hash-verified

35
36/// float equality (hack! - does not handle NaN/Infinity, see https://floating-point-gui.de/errors/comparison/)
37pub fn float_eq(a: f32, b: f32) -> bool {
38 (a - b).abs() <= f32::EPSILON
39}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected