NaN vs. Inf

1 Ansicht (letzte 30 Tage)
Laurence Lurio
Laurence Lurio am 31 Dez. 2011
Why is
1/0 = Inf
but
[1,0]./[1,0] = [1 NaN]
shouldn't it be [1 Inf]?

Akzeptierte Antwort

Image Analyst
Image Analyst am 31 Dez. 2011
1/0 is infinity, but 0/0 is not infinity nor is it zero - it's just undefined (NaN).
  1 Kommentar
Matt Tearle
Matt Tearle am 31 Dez. 2011
And if you want to know *why*, think in terms of limits. lim_{x->0} 1/x = infinity. But lim_{x->0} x^2/x = 0, lim_{x->0} x/x = 1, and lim_{x_>0} x/x^2 = infinity. So there's no way to determine what a "0/0" limit might be. Hence, it's undefined (NaN).
Similarly, Inf + Inf = Inf, but Inf - Inf = NaN.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Jose Jeremias Caballero
Jose Jeremias Caballero am 31 Dez. 2011
Hi.
[1,0]./[1,0]= [1/1,0/0]=[1,NaN]
  1 Kommentar
Jan
Jan am 1 Jan. 2012
The question is, why 0/0=NaN and not Inf.

Melden Sie sich an, um zu kommentieren.


Jose Jeremias Caballero
Jose Jeremias Caballero am 2 Jan. 2012

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by