#[derive] verbosity (which I hope can be fixed somehow) these traits become annoying only when using the floating-point types.
So how about making it easy for users to avoid these traits by introducing a fast, finite-only floating point type instead?
This could solve two problems at once, as the new floating point type could also work as an enabler of
-ffast-math which Rust currently lacks.
The new floating-point type would forbid
Inf (caught with debug assertions similarly to overflows), which makes
Ord well-defined and use fast intrinsics for arithmetic operations, allowing more aggressive optimizations.
I’ve prototyped a newtype f32 wrapper that uses the fast intrinsics, but newtypes don’t work with floating-point literals and the
as operator (and AFAIK there’s no intention to ever allow that), so it’d be much better as a built-in Rust type.