equal

Function equal 

Source
pub const fn equal(x: f32, y: f32) -> bool
Expand description

Checks if two floats are equal, within the LAYOUT_EPSILON threshold.

This is useful for comparing float values in a layout context, as floating point precision can cause small differences that are not significant and therefore need no redraw.

Example:


// Significant change. Should redraw.
assert!(!layout::equal(10.0, 20.0));

// Insignificant change. Should not redraw.
assert!(layout::equal(10.0, 10.005));