[plt-scheme] Test a numbers representation to see if it's complex?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jun 4 18:51:33 EDT 2007

At Tue, 05 Jun 2007 00:43:25 +0200, Jens Axel Søgaard wrote:
> Matthew Flatt skrev:
> > At Mon, 04 Jun 2007 17:03:06 -0500, Chongkai Zhu wrote:
> >> Yes, my `0-imag-part?' fails for some cases.
> > 
> > Which cases?
> > 
> >> Jens Axel Søgaard wrote:
> >>> The problem is that 3.0 and 3.0+0.0i is the same number.
> >>> The real part and the imaginary part shares the exactness.
> > 
> > No, they're different:
> > 
> >  > (eqv? 3.0 3.0+0.0i)
> >  #f
> 
> That's odd.
> 
>  From R5RS section 6.1:
> 
>    The eqv? procedure returns #t if:
> 
>      * obj1 and obj2 are both numbers, are numerically equal (see =,
>        section 6.2), and are either both exact or both inexact.

Yep, chalk up another divergence from R5RS (and another details that
R6RS fixes).

I note that Gambit 4.0beta20 and Petite Chez 7.3 behave like PLT Scheme
in this case.

Matthew



Posted on the users mailing list.