Why float('Nan') == float('Nan') is False

Chris Angelico rosuav at gmail.com
Wed Feb 13 19:29:12 EST 2019

On Thu, Feb 14, 2019 at 11:01 AM songbird <songbird at anthive.com> wrote:
>   all such proofs i have ever seen are based upon the
> assumptions that there are infinite numbers of such
> things like primes.

I posted an abbreviated proof of that in a footnote. It's a proof by
contradiction. First, assume that there are, in fact, a finite number
of primes. If that's the case, then all primes must be integers
between 2 and some number p, the highest prime. Take the product of
all primes - call it x. When you take the product of positive
integers, the result must always be at least as large as any of the
factors, so x >= p. Also, x must be a multiple of every prime, which
in turn means that x+1 cannot possibly be a multiple of any such
prime. Thus the value x+1 must either be prime, or be the product of
prime numbers that aren't in your collection of primes; therefore the
collection of primes cannot possibly be complete. Therefore there are
indeed an infinite number of primes.

So it's not an assumption; it's a proven point.

The subdividability of the universe is actually irrelevant. Perhaps
the universe, at some level, becomes indivisible; but numbers don't.
For any two non-equal real numbers, it is always possible to find
another number in between them. (This is NOT true of floating-point
numbers or any other fixed-size representation.) Numbers are actually
extremely convenient like that.

This is largely off-topic for Python, but do consider: thanks to
bignum integers and the Fraction type, we can represent any rational
number, assuming we have enough storage space. Or do we.....


More information about the Python-list mailing list