Per Bothner scripsit:
> >This would not work reliably in a (hypothetical) system in which
> >inexact numbers are represented as ratnums with an "inexact" bit
> >and in which ratnums do not have to be in lowest terms.
>
> Then they wouldn't be flonums.
Au contraire. Flonums are simply a subset (proper or improper) of the
inexact real numbers, possibly enhanced with some other members
such as +inf.0, -inf.0, and +nan.0. R6RS section 2.1 explicitly says
that flonums need not have floating-point representations.
Note also that there is no requirement that irrational real numbers
be representable within the Scheme number system, and most Schemes
do not represent them, with the exception of the same three special cases.
> >But what's really at stake here is that users shouldn't expect
> >reliable results from eqv? on two NaNs generated by different
> >processes (where reading "+nan.0" counts as a process), even
> >on a single system.
>
> Yes, they should.
Well, we'll argue that point (said Jack). To do this, the definition
of flonum equality on systems where flonums are IEEE in nature must
check each argument to see if it is a NaN rather than simply doing
a bitwise comparison. Fair enough if that's what people want.
> >This conforms to the definition of NaN
> >in R6RS as a number so inexact that it could be any real number
> >at all.
>
> That is not what NaN is. A NaN is a concrete value with a concrete
> representation. (According to IEEE there can be many NaN values but
> that doesn't change the argument.) You can test for it. Java and C#
> have a isNaN math; C (at least glibc) has an fpclassify function that
> can return FP_NAN.
Well, it's what Section 2.4 says a NaN is, and AFAIK neither Java nor
C prescribes whether NaNs with different representations are or are not
identical. In Java, at any rate, NaN == NaN is always false, for Java
has no identity for numbers other than numeric equality.
> But I just gave a specification for *flonum*. If flonums don't
> exist, then the specification doesn't apply.
Flonums always exist in R6RS systems.
--
John Cowan http://ccil.org/~cowan cowan_at_ccil.org
'My young friend, if you do not now, immediately and instantly, pull
as hard as ever you can, it is my opinion that your acquaintance in the
large-pattern leather ulster' (and by this he meant the Crocodile) 'will
jerk you into yonder limpid stream before you can say Jack Robinson.'
--the Bi-Coloured-Python-Rock-Snake
Received on Wed Sep 20 2006 - 13:00:39 UTC