+ 1

Why is 10/0 infinity in javascript?

Division by 0 is undefinable, so it should not be infinity. Or am I wrong?

5th Nov 2018, 7:07 PM
Juho Pesonen
Juho Pesonen - avatar
5 Antworten
+ 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"
5th Nov 2018, 9:34 PM
Matthias
Matthias - avatar
+ 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.
5th Nov 2018, 7:24 PM
Anya
Anya - avatar
+ 4
Matthias i suppose we can do this with negative numbers too and name what we call "negative infinity".
5th Nov 2018, 10:03 PM
Anya
Anya - avatar
+ 2
sure 👍
6th Nov 2018, 6:54 AM
Matthias
Matthias - avatar