3 ms·
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.
by tim333 7y ago
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.
- strainer 7y agoThis is not only javascripts behavior, it is the IEEE standard for floating-point arithmetic which most modern hardware and software strictly adheres to.
- dylan604 7y agoThis should be part of an update to the Destroy All Software's Wat video: https://www.destroyallsoftware.com/talks/wat https://www.destroyallsoftware.com/talks/wat
- garmaine 7y agoExcept that is defined, standard IEEE 754 behavior and is true on nearly all programming languages.
- stOneskull 7y ago-0 is my favorite number