> From: Jan Wedekind <[email protected]>
> Subject: bug#29387: Guile-2.2.2 complex numbers edge case
> Date: 21 Nov 2017 23:09:57 GMT+1
> To: [email protected]
> Reply-To: Jan Wedekind <[email protected]>
> 
> 
> Hi,
> I think I encountered a bug in the numerical stack.
> i times i should equal -1:
> 
>    (equal? -1 (* 0+i 0+i))
>    ; #f
> 
> i times i plus one is zero (which is correct):
>    (zero? (+ (* 0+i 0+i) 1))
>    ; #t
> 
> Regards
> Jan

In Guile 0+i and (* 0+i 0+i) are inexact numbers, but -1 is exact. That's why 
equal? fails.

You can check that either of

(equal? -1.+0. (* 0+i 0+i))

or

 (= -1 (* 0+i 0+i))

return true, as expected.

I don't know if the fact that Guile doesn't have exact complex numbers could be 
considered a bug. AFAIR none of the standards require them to be implemented. 
On the other hand I just checked and both Racket and Chez seem to have them, 
so...

regards

        Daniel

Reply via email to