[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (/ 0 0.0) ==> 0
Quoting Wolfgang Hukriede:
> Hello!
>
> Welcome to MzScheme version 100alpha1,
> Copyright (c) 1995-99 PLT (Matthew Flatt)
>
> > (/ 0 0.0)
> 0
>
> Is this result intented?
Yes.
Inexact zero is interpreted as "a positive number arbitrarily close to
zero, but not quite zero". Similarly, -0.0 is "a negative number
arbitrarily close to zero". Hence, (/ 1 0.0) is not undefined, but
rather an arbitrarily large positive number, +inf.0, and so on.
You can find holes in this interpretation easily. For example, why
should (+ 0.0 -0.0) be 0.0?
For summary of the issues, see Brad Lucier's notes from the '98
workshop:
http://www.neci.nj.nec.com/homepages/kelsey/lucier.txt
I believe the only way that MzScheme disagrees with Brad's
recommendation is that (real? +0.0i) = #t. Chez and Gambit take
essentially the same position, as far as I can tell, including the
concession in `real?'.
One final note --- I found an inconsistency in MzScheme that survived
in version 101: (angle 0.0) reports an error. (angle 0.0) should
instead be 0, and (angle -0.0) should be pi. This is consistent with
MzScheme's distinction between 0.0+0i and 0.0+0.0i, and with the notion
of 0.0 as "infinitesimally small". Also, (angle +nan.0) didn't return
+nan.0.
Obviously, almost none of this is documented in the MzScheme manual at
the moment...
Matthew