+ 1
Why is 10/0 infinity in javascript?
Division by 0 is undefinable, so it should not be infinity. Or am I wrong?
5 Réponses
+ 4
See it as a limit, not as number.
1/0.1 = 10
1/0.01 = 100
1/0.001 = 1000
1/0.000..01 = extremely big
And since a computer cannot represent ifinitely many digits 0.000...01 is basically zero and similar the extremley big number is "infinity"
+ 8
Vicious in language. The proper term for x/0 if x not equals 0 is undefined. 0/0 is indeterminate.
undefined not equals indeterminate.
People just user infinity term in this case wrong in literature over and over. That is the reason.
The proper way to avoid this is throw a error.
Can be just a design call ? it can but just makes confusion.
+ 4
Matthias i suppose we can do this with negative numbers too and name what we call "negative infinity".
+ 2
sure 👍