4 ms·
Interesting case is that Rust's cmp::max() doesn't support floating-point numbers, because maximum is undefined for Inf and NaN. For floats there's partial_max
by pornel 11y ago
Interesting case is that Rust's cmp::max() doesn't support floating-point numbers, because maximum is undefined for Inf and NaN.
For floats there's partial_max() which returns Option<f32>.
It makes sense, but it never crossed my mind before that a simple max() function can fail.
It's also PITA to error-check such a simple thing, but somewhat surprisingly there's also f32.max() that works on garbage-in garbage-out principle.