2 ms·
I don't think the JVM guarantees the bit pattern will be preserved when passing it around. I know this is the case for NaNs where I have experienced the bit pat
by kodablah 9y ago
I don't think the JVM guarantees the bit pattern will be preserved when passing it around. I know this is the case for NaNs where I have experienced the bit pattern change [0].
0 - https://stackoverflow.com/questions/43129365/javas-math-rint-not-behaving-as-expected-when-using-nan https://stackoverflow.com/questions/43129365/javas-math-rint...
- jnordwick 9y agoIt would be really depressing if java normalized NaNs, but i wouldn't put it past some author thinking it was a good idea.
- kodablah 9y agoIt's not that they normalize them per se, it's just that NaN bit patterns are mostly undefined behavior. I think the JVM spec (or JLS, I forget) implies that you can't really rely on the NaN bit patterns being retained. Double.longBitsToDouble mentions that some processors might not return a double in the same bit pattern as passed.