servo / euclid

Geometry primitives (basic linear algebra) for Rust
Other
458 stars 102 forks source link

Length::max/min not implemented for floating point numbers #407

Closed HalfVoxel closed 4 years ago

HalfVoxel commented 4 years ago

euclid::Length::min/max is only implemented for types implementing the Ord trait. Floating point types do not implement this trait, however it is common to use min/max operations for them anyway.

I would suggest that a method with the same semantics as f32::max/min is implemented (i.e. NaN is handled in a special way).

nical commented 4 years ago

Things have improved recently. Length does not implement min/max as far as I can tell, but the other types that do implement it via PartialOrd instead of Float.