Search code examples
javascriptmathinfinity

Why is Infinity / Infinity not 1?


If

Infinity === Infinity
>> true

and

typeOf Infinity
>> "number"

then why is

Infinity / Infinity
>>NaN

and not 1?


Solution

  • Beware any assumptions you make about the arithmetic behaviour of infinity.

    If ∞/∞ = 1, then 1×∞ = ∞. By extension, since 2×∞ = ∞, it must also be the case that ∞/∞ = 2.

    Since it has come up in discussion against another answer, I'd like to point out that the equation 2×∞ = ∞ does not imply that there are multiple infinities. All countably infinite sets have the same cardinality. I.e., the set of integers has the same cardinality as the set of odd numbers, even though the second set is missing half the elements from the first set. (OTOH, there are other kinds of "infinity", such as the cardinality of the set of reals, but doubling the countable infinity doesn't produce one of these. Nor does squaring it, for that matter.)