guile-user
[Top][All Lists]
Advanced

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

Re: Can somebody help to explain why result from atan does not equal a r


From: Mark H Weaver
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Hengqing Hu <address@hidden> 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



reply via email to

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