Hengqing Hu <hengqing...@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