bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29387: Guile-2.2.2 complex numbers edge case


From: Daniel Llorens
Subject: bug#29387: Guile-2.2.2 complex numbers edge case
Date: Wed, 22 Nov 2017 16:53:00 +0100


From: Jan Wedekind <address@hidden>
Subject: bug#29387: Guile-2.2.2 complex numbers edge case
Date: 21 Nov 2017 23:09:57 GMT+1
Reply-To: Jan Wedekind <address@hidden>


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

[Prev in Thread] Current Thread [Next in Thread]