From: Mark H Weaver <mhw@netris.org>
To: Hengqing Hu <hengqing.hu@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: Can somebody help to explain why result from atan does not equal a real?
Date: Thu, 31 Jan 2013 18:51:50 -0500 [thread overview]
Message-ID: <87txpwgbc9.fsf@tines.lan> (raw)
In-Reply-To: <CADFbkvB-xhoNw2b8ubZecKoc4VmiC_dycVjZA3p3KHEGhaHbmg@mail.gmail.com> (Hengqing Hu's message of "Thu, 31 Jan 2013 18:50:43 +0800")
Hengqing Hu <hengqing.hu@gmail.com> writes:
> The following behavior is observed on both guile 1.8 and guile 2.0.
> Is it correct?
> Can somebody elaborate why it happens?
>
> guile> (atan 0 -1)
> 3.14159265358979
> guile> (= 3.14159265358979 3.14159265358979)
> #t
> guile> (= (atan 0 -1) 3.14159265358979)
> #f
Sorry, this is due to an inadequate 'number->string' implementation in
Guile. A proper implementation should guarantee that when the string is
read back in, you'll get precisely the same number back, and recent
Scheme standards mandate this. At present, Guile does not always print
enough digits to guarantee this.
I plan to soon rewrite Guile's 'number->string' based on "Printing
Floating-Point Numbers Quickly and Accurately" by Dybvig and Burger.
I recently started that work but became distracted by more pressing
matters. I hope to get back to it soon.
Regards,
Mark
next prev parent reply other threads:[~2013-01-31 23:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-31 10:50 Can somebody help to explain why result from atan does not equal a real? Hengqing Hu
2013-01-31 13:32 ` Noah Lavine
2013-01-31 14:50 ` John Darrington
2013-01-31 14:52 ` Noah Lavine
2013-01-31 23:51 ` Mark H Weaver [this message]
2013-02-01 0:30 ` Mark H Weaver
2013-02-01 9:10 ` Mark H Weaver
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=87txpwgbc9.fsf@tines.lan \
--to=mhw@netris.org \
--cc=guile-user@gnu.org \
--cc=hengqing.hu@gmail.com \
/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).