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

Agreed, NaN can be very useful indeed in certain circumstances. If nothing else, a NaN is still a floating point primitive, and can be stored in a large array with other floating point numbers, whereas an exception cannot. If you want an exception, just test Double.isNaN(), and throw one.

NaNs should not be scary.



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

Search: