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

Well, in javascript 0/0 == NaN while 1/0 == Infinity.

An interesting thing is they have the value -0 so you can set a=-0 and 1/a returns -Infinity.




This is not only javascripts behavior, it is the IEEE standard for floating-point arithmetic which most modern hardware and software strictly adheres to.


-0 is my favorite number


This should be part of an update to the Destroy All Software's Wat video: https://www.destroyallsoftware.com/talks/wat


Except that is defined, standard IEEE 754 behavior and is true on nearly all programming languages.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: