emath

Function almost_equal

source
pub fn almost_equal(a: f32, b: f32, epsilon: f32) -> bool
Expand description

Return true when arguments are the same within some rounding error.

For instance almost_equal(x, x.to_degrees().to_radians(), f32::EPSILON) should hold true for all x. The epsilon can be f32::EPSILON to handle simple transforms (like degrees -> radians) but should be higher to handle more complex transformations.