On 12/26/2010 10:33 PM, John Cowan wrote:
> Per Bothner scripsit:
>> 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.

The specification should probably note that an implementation may return
either exact or inexact for the real-part of the sqrt of a negative real.
As it is, the examples are arguably incorrect in that they (inconsistently)
over-specify the exactness of the real-part.
-- 
        --Per Bothner
p...@bothner.com   http://per.bothner.com/

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

Reply via email to