On 12/28/19 10:05 PM, David Mertz wrote:
On Sat, Dec 28, 2019, 9:36 PM Richard Damon <rich...@damon-family.org
<mailto:rich...@damon-family.org>> wrote:
> NaN may be an instance of the abstract type Number, but is isn't
a mathematical number.
Yes, floating point numbers are not pure-math Reals. Not even
Rationals. They are a CS construct that is very useful for computer
programs that very approximately resemble Rationals.
One of the necessary details in that approximation is that NaN is a
special "computer number." You get it as a result of some operations
where other answers aren't possible in the system. Inf is the same
way. It's not a Rational. It's also not omega-zero in set theory. It's
just a thing the system does to be "pretty good" more of the time.
They are all "numbers."
... or if you insist: no floating point number is a "number." (not a
closed field, operations not transitive, blah blah)
Every value of the type float, except NaN and perhaps +inf and -inf
(depending on which version of the Real Number Line you use) IS actually
a representation of a Real Number (so I don't understand in what way you
can say they aren't "numbers"). And yes, they happen to also be Rationals.
Yes, the type float doesn't create a precise field in itself, but it is
a close model to a reasonable subset of the actual Real Numbers. If you
use that approximation, there is a lot you can say about using the float
type (in fact the whole statistics module is based on this sort of
correlation). This approximation only works if you realize and define
that the float value NaN isn't a "Real Number" (and +inf and -inf are
just "Extended Real Numbers"). Break that definition and you lose all
the mathematical support to understand floating point numbers (or you
have to keep saying float numbers except NaN).
I suppose this is part of the root of the confusion with IEEE floating
point, that this numeric type as a value that isn't a number (and the
rules of IEEE handle it that way).
--
Richard Damon
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/SIUC4KOB33VVFAX4WZWX27JUIH63XBG4/
Code of Conduct: http://python.org/psf/codeofconduct/