Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> If we have some positive 32-bit integers A and B then if A < B, f32::from_bits(A) < f32::from_bits(B)

That is, if both are valid floats that represent a finite non-zero number.



Correct.

Floats support both -0 and 0 they compare equal but their bit representations don't. Zero can be tricky.

Not a numbers (NaNs) always compare as false. Their bit representations won't.




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

Search: