Subject: Re: bug#19025: 24.4; precision error when adding two floats
From: Stefan Monnier <[email-masked]>
To: "Kevin W. Currey" <[email-masked]>
Cc: [email-masked]
Date: Tue, 11 Nov 2014 21:06:35 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

tags 19025 notabug
thanks

> (message "%s" (+ 379.744 57.93))
> The above prints 437.67400000000004.

That's the difference between floating-point numbers and real or
rational numbers.

> (message "%s" (format "%f" (+ 379.744 57.93)))

You can cut the middle man: (message "%f" (+ 379.744 57.93))

But note that this prints something "incorrect":

     M-: (message "%f" (+ 379.744 57.93))
     => 437.674000.
     M-: (equal (+ 379.744 57.93) 437.674000)
     => nil

It's just that %f rounds differently.

        Stefan