From: Daniel Llorens <daniel.llorens@bluewin.ch>
To: 29387@debbugs.gnu.org
Cc: jan@wedesoft.de
Subject: bug#29387: Guile-2.2.2 complex numbers edge case
Date: Wed, 22 Nov 2017 16:53:00 +0100 [thread overview]
Message-ID: <1600114F-E0CB-4B05-AA8C-4A1A8EB11786@bluewin.ch> (raw)
In-Reply-To: <mailman.9100.1511364130.27994.bug-guile@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 960 bytes --]
> From: Jan Wedekind <jan@wedesoft.de>
> Subject: bug#29387: Guile-2.2.2 complex numbers edge case
> Date: 21 Nov 2017 23:09:57 GMT+1
> To: 29387@debbugs.gnu.org
> Reply-To: Jan Wedekind <jan@wedesoft.de>
>
>
> 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
[-- Attachment #2: Type: text/html, Size: 2800 bytes --]
next parent reply other threads:[~2017-11-22 15:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.9100.1511364130.27994.bug-guile@gnu.org>
2017-11-22 15:53 ` Daniel Llorens [this message]
2017-11-22 18:32 ` bug#29387: Guile-2.2.2 complex numbers edge case Jan Wedekind
[not found] ` <FE47AB49-84AF-494F-9AEA-160AB09FB4FF@bluewin.ch>
2017-11-23 14:48 ` Daniel Llorens
2017-11-21 22:09 Jan Wedekind
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1600114F-E0CB-4B05-AA8C-4A1A8EB11786@bluewin.ch \
--to=daniel.llorens@bluewin.ch \
--cc=29387@debbugs.gnu.org \
--cc=jan@wedesoft.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).