Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why 0/0 is NaN and not infinity in Javascript [duplicate]

Division by zero (1/0, 2/0, 3/0, etc) produces infinity. However 0/0 produces NaN. Why?

like image 960
nicael Avatar asked Oct 16 '25 17:10

nicael


1 Answers

Mathematically it's most certainly not infinity. if it was obtained from limit x^2/x as x -> 0, it should be 0, for instance. x/x^2 would give infinity, though.

It's an indeterminate form, and in some sense more indeterminant than 1/0, 2/0 etc. In short, much more of your math would be mucked up from replacing 0/0 with Infinity than replacing 1/0 with infinity, because it's not clear that the denominator effect of dividing by zero should overwhelm the multiplication by zero effect of the numerator.

like image 94
djechlin Avatar answered Oct 18 '25 08:10

djechlin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!