Double.NaN Is Evil

I don’t know what Sun had in mind when creating Double.NaN number. It is very inintuitive to use. I am sure every single developer out there fell in the trap of trying to find out if a double was NaN or not using:

Double.NaN == myDouble

This does not work (I don’t know the real reason why), one has to use:

Not intuitive!

comments powered by Disqus
Tweet Submit to reddit
© 2006-16 Fabien Creative Commons License This work is licensed under a Creative Commons Attribution 4.0 International License.