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: Jan Wedekind
Subject: bug#29387: Guile-2.2.2 complex numbers edge case
Date: Wed, 22 Nov 2017 18:32:09 +0000
User-agent: K-9 Mail for Android

Thanks Daniel,
I see. So I need to use "=" for numerical comparisons. "equal?" is only true if the types are the same, too:

(equal? 1.0 1)
; #f
(= 1.0 1)
; #t

Sorry for filing a bug report. Feel free to close the bug.

Regards
Jan

On November 22, 2017 3:53:00 PM GMT, Daniel Llorens <address@hidden> wrote:

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]