[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0

Mark H Weaver scripsit:

> Yes, that's exactly what I mean.  I know that SCM and Gauche do this,
> and I suspect it's quite common.

Okay, the details are at ComplexRepresentations now.  Racket, Kawa, Chez,
Vicare, Larceny, Ypsilon, !IronScheme, Spark support (imag-part 2.0) => 0
even though they don't support mixed-exactness complex numbers.

> >> Another test that would be worthwhile is this:
> >> 
> >>   (list (eqv? +0.0 -0.0)
> >>         (eqv? (make-rectangular +0.0  1.0)
> >>               (make-rectangular -0.0  1.0))
> >>         (eqv? (make-rectangular  1.0 +0.0)
> >>               (make-rectangular  1.0 -0.0))
> >> 
> >> I wouldn't be surprised if some Schemes distinguish signed zeroes in the
> >> real part but not in the imaginary part.  If an implementation discards
> >> inexact zero imaginary parts, then it probably discards the sign as well
> >> as the exactness.

The results here weren't interesting: they were all either (#t #t #t)
or (#f #f #f), or throwing an error on undefined `make-rectangular`,
with the sole exception of Vicare, which returns (#t #f #f).  However,
this version does not properly defend against systems which interpret
`-0.0` as just another spelling of 0.0 even though they support negative
zero internally.  I may attempt that later, though I doubt the results
will be any more interesting.  My guess is that `make-rectangular`
always returns a boxed or unboxed pair of numbers whatever the values
may be on every system that supports complex numbers at all.

A mosquito cried out in his pain,               John Cowan
"A chemist has poisoned my brain!"              http://www.ccil.org/~cowan
        The cause of his sorrow                 cowan@x
        Was para-dichloro-
Diphenyltrichloroethane.                                (aka DDT)

Scheme-reports mailing list