Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
tim333
on May 24, 2019
|
parent
|
context
|
favorite
| on:
What's the difference between 0/0 and 1/0?
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
on May 24, 2019
|
next
[–]
This is not only javascripts behavior, it is the IEEE standard for floating-point arithmetic which most modern hardware and software strictly adheres to.
stOneskull
on May 25, 2019
|
prev
|
next
[–]
-0 is my favorite number
dylan604
on May 24, 2019
|
prev
[–]
This should be part of an update to the Destroy All Software's Wat video:
https://www.destroyallsoftware.com/talks/wat
garmaine
on May 25, 2019
|
parent
[–]
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:
An interesting thing is they have the value -0 so you can set a=-0 and 1/a returns -Infinity.