|
|
|
|
|
by ratorx
1254 days ago
|
|
The missing bit is language tooling. The regular floating point API exposed by most languages don’t force handling of NaNs. The benefit of the option type is not necessarily just the extra value, but also the fact that the API that forces you to handle the None value. It’s the difference between null and Option. Even if the API was better, I think there’s value in expressing it as Option<FloatGuaranteedToNotBeNaN> which compiles down to using NaNs for the extra value to keep it similar to other Option specialisations and not have to remember about this special primitive type that has option built in. |
|
https://internals.rust-lang.org/t/pre-rfc-nonnan-type/8418