euclid icon indicating copy to clipboard operation
euclid copied to clipboard

Document `max` and `min` NaN (`partial_cmp() == None`) behavior

Open kpreid opened this issue 10 months ago • 0 comments

The max() and min() functions in approxord and on vector types do not follow the behavior of f64::max when the element type is a float:

If one of the arguments is NaN, then the other argument is returned. This follows the IEEE 754-2008 semantics for maxNum, except for handling of signaling NaNs

Instead, they return the second argument, which may be the one that is NaN. This behavior should be documented, since it is non-commutative, and potentially surprising, particularly when one is thinking about floats rather than the fact that Point3D etc. are generic types whose methods must use traits of the component type.

kpreid avatar Dec 26 '24 19:12 kpreid