[r6rs-discuss] [Formal] Formal Comment: NaN should be considered a number, not a real
Joe Marshall wrote:
>
> On 6/22/07, Thomas Lord <lord at emf.net> wrote:
>>
>> That's wrong. NaN is not an interval.
>>
>> All normal floating point numbers are intervals.
>
> That's wrong (and a common misconception). All normal floating point
> numbers
> are exact rational numbers. While it is true that there are intervals
> on the real
> number line where every real in the interval maps to the same floating
> point number,
> the floating point number itself is just a rational.
>
>
That is a misleading way to describe the situation.
Floating point numbers may be interpreted as certain
Rationals, to be sure. (I'm capitalizing set names
when I mean the mathematical sets as opposed to
Scheme's type categories.)
However, the semantics of those floating point numbers
comes from regarding each of those rationals
as the name for an interval of the Reals. The rational
number stored in the bits of a floating point number
are the "canonical members" of those intervals. (The
inf intervals are exceptional: they have no characteristic
member and the semantics of floating point math reflects
this.)
When we write floating point numbers like "0.1", we
are essentially writing "There exists a number X in the
interval [0.1-epsilon_a .. 0.1+epsilon_b]" and we go
from there. The "terms" in floating point equations
are all existentially qualified statements like that. The
"operators" in floating point equations reliably draw
certain inferences from one or two of those terms, generating
a new term of the same form (or NaN): "there exists
A near 0.25 and there exists B near 0.5 so there
exists C near 0.75"
The particular inferences an FPU will draw are, in part, defined with
reference to the characteristic dyadic rationals of the
finite intervals in the system -- but the semantics are
really "about" those intervals (the ones implied by those
existentially qualified statements). You can also see that the
semantics are really "about" the intervals, not the rationals
per se, from the treatment of inf or the treatment of rounding.
The interval view, as opposed to seeing floating points
as Rationals, is also a good way to make sense of figuring
out error terms for results from an FPU under various
conditions and assumptions.
-t
Received on Fri Jun 22 2007 - 16:20:26 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC