[r6rs-discuss] [Formal] Formal Comment: NaN should be considered a number, not a real
I don't have a cite handy but maybe someone can play with
Google to find it. Sun Microsystems, some years ago,
published a long paper called something like "everything programmers
need to know about floating point numbers" which I would like
to recommend.
Arthur Smyles wrote:
> Second, +inf and -inf are not ranges they are points.
That's wrong too.
1.0 / 0.0 == +inf for a very specific reason: that "0.0" might not
actually mean "naught". In particular, "0.0" might mean "a very,
very small positive Real number (or negative)". Thus, "+inf"
means "a very, very large Real number."
A visualization that I can't do much justice to in ASCII might
help:
There are a finite number of bit patterns corresponding to floating
point numbers. These are distributed on the real line (except for
NaN). They are distributed unevenly:
...============== -1 === 0 === 1 ===============...
^ ^ ^ ^ ^ ^ ^ ^^^^^^^^^^^^ ^ ^ ^ ^ ^ ^ ^
Each bit pattern is the name for the interval formed by splitting the
distance to its neighbors. For example, "0.0" really means "plus
or minus epsilon".
Since the list of bit patterns is finite, it has a start and end --
there smallest and largest floating point bit patterns. Each of those
has no neighbor on one side:
========================
^ ^ (no
neighbor on this side)
+inf
Those "inf" values therefore stand for half-infinite intervals.
When you ask a floating point unit to compute something like x/y
you are asking, in effect "Suppose I know that there is a number X in
one interval, and a number Y in another interval -- In what interval
can I find the quotient of these numbers, if it exists?"
The "+inf" and "-inf" answers tell you "The quotient might exist
and, if so, it is very very large or very very small".
When an operation gives you "NaN" it is telling you that "Either
the floating point circuits can prove that no answer exists or
they can prove that they can not prove that any answer might exist."
-t
Received on Fri Jun 22 2007 - 14:41:04 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC