Per Bothner scripsit:

> R6RS seems to require support for "mixed-exactness"
> complex numbers.  I.e. numbers where the real part is exact
> while the imaginary part of inexact or vice versa.
> That is implied by these examples for real?:
>    (real? -2.5+0.0i) ==> #f
>    (real? -2.5+0i) ==> #t

I don't think such support is required in the general case.  The real
numbers and the complex numbers with exact 0 as the imaginary part can
be identified.  Of my usual suite of Schemes, only SISC fails to make
them the same in the sense of EQV?.

> I.e. -2.5+0i is equivalent to -2.5 and has an exact zero
> imaginary part.
> 
> So logically a pure imaginary value has an exact zero real part.
> 
> So what does the square root of a negative real return?
> Is the real part exact zero or inexact zero?  

Sqrt is free to return inexact results on exact arguments, and
a mixed-exactness number is inexact (in the sense that INEXACT?
answers #t to it).

>    (sqrt -5) ==> 0.0+2.23606797749979i

That works for the same reason that (sqrt 4) may return 2.0.

>    (sqrt -inf.0)  ==>  +inf.0i
> i.e. with an exact real part.

That is also licit.

-- 
John Cowan  co...@ccil.org  http://ccil.org/~cowan
The competent programmer is fully aware of the strictly limited size of his own
skull; therefore he approaches the programming task in full humility, and among
other things he avoids clever tricks like the plague.  --Edsger Dijkstra

_______________________________________________
r6rs-discuss mailing list
r6rs-discuss@lists.r6rs.org
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to