I'm wondering about following question, if infinity equals infinity (in a computer) and negative infinity equals negative infinity, why does the last sentence of the following snippet return false?
In [2]: math.inf == math.inf
Out[2]: True
In [3]: -math.inf == -math.inf
Out[3]: True
In [4]: (-math.inf) + (math.inf) == (-math.inf) + (math.inf)
Out[4]: False
In [5]:
I tried with several languages (C++, Javascript and Haskell) and all results are the same. I supposed it is something related to x86_64 architecture, but I'm not sure.