Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0
John Cowan 16 Dec 2012 04:10 UTC
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:
(let
((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@ccil.org 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
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports