Is there consensus on how to treat panic on NaN?

I would love it if Rust 2018 had one way to order some numbers where NaNs and infinities are programming errors that should result in a panic.

This seems like an idiom that is a legitimate use case of rust, but we'd all have an easier life if this choice was baked into std somehow.

Impls I know of:

https://github.com/DanielKeep/rust-numeric-float
https://github.com/SergiusIW/noisy_float-rs
https://github.com/mmrath/pure_decimal

I'm sure there's more out there.

2 Likes

Is there already an equivalent in the std library that I don’t know about?