Hacker News new | past | comments | ask | show | jobs | submit login

No, because NaN is a valid floating point number in rust.



There really should be a ”normal” f32 and f64 type with guarantees for non-NaN, similar to the nonzero integers. More importantly than size, these floats would be totally ordered unlike the partially ordered regular ieee floats.

Edit: turns out these exist in various forms e.g “noisy float”


"in IEEE-754 there are 2^53-2 different bit patterns that all represent NaN"

From https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Sp..., which describes how Mozilla implements nan-boxing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: