compare_approx

Function compare_approx 

Source
fn compare_approx<T>(a: T, b: T) -> Ordering
where T: Copy + PartialOrd + ApproxEq<Margin = F64Margin>,
Expand description

Compares two values with approximate equality checking.

Returns Ordering::Equal if the values are approximately equal according to the default floating-point margin, otherwise returns their relative ordering based on a.partial_cmp(&b).

This is useful when comparing floating-point-based types where exact equality may not be appropriate due to numerical precision limitations.

ยงPanics

Panics if partial_cmp returns None (i.e., if either value is NaN).