[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:

> There are several other ways of checking for this, such as:
>   (eqv? 1.0+0.0i 1.0+0i)
> and
>   (eqv? (make-rectangular 1.0 0.0)
>         (make-rectangular 1.0 0))

Those are also consistent with (make-rectangular x 0) simply returning
a flonum.

> For the three implementations I mentioned (Guile 2, Racket, and Ikarus)
> the expressions above return #f.

I tried the 45 Schemes (less those with no make-rectangular support) with
this expression:

  ((m (make-rectangular 2.0 2))
   (z (make-rectangular 2.0 0)))
     (list m z (real? m) (real? z)))

All the Schemes, except those which don't support make-rectangular, replied
either (2.0+2i 2.0 #f #t) or (2.0+2.0i 2.0 #f #t), which is consistent
with all implementations not even returning a rectnum or compnum for z,
but a simple flonum.  This is quite independent of how eqv? behaves.

This behavior is required by ANSI CL, function COMPLEX.

John Cowan    cowan@x    http://ccil.org/~cowan
Objective consideration of contemporary phenomena compel the conclusion
that optimum or inadequate performance in the trend of competitive
activities exhibits no tendency to be commensurate with innate capacity,
but that a considerable element of the unpredictable must invariably be
taken into account. --Ecclesiastes 9:11, Orwell/Brown version

Scheme-reports mailing list