Date: Sun, 11 Jul 2004 19:40:31 +0200 From: Dimitry Andric <dimitry@andric.com> To: Dmitry Morozovsky <marck@rinet.ru> Cc: freebsd-hackers@freebsd.org Subject: Re: gcc strangeness Message-ID: <115911306.20040711194031@andric.com> In-Reply-To: <20040711210219.J84500@woozle.rinet.ru> References: <20040711210219.J84500@woozle.rinet.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
------------D81AD301C85E2F5 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On 2004-07-11 at 19:06:32 Dmitry Morozovsky wrote: > 1.000000 1.000 0 > 2.000000 2.000 1 > 3.000000 3.000 2 > 4.000000 4.000 3 > 5.000000 5.000 5 > 6.000000 6.000 6 > 7.000000 7.000 7 > 8.000000 8.000 7 > 9.000000 9.000 8 > 9.999999 10.000 9 Yes, this is completely normal if you use IEEE floating point, due to decimal <-> binary conversion and other accumulating rounding errors. In other words, floating point calculations will almost never be exact... This is not a gcc problem. In fact, I can even reproduce your output under Windows using a Microsoft C compiler! :) ------------D81AD301C85E2F5 Content-Type: application/pgp-signature -----BEGIN PGP MESSAGE----- Version: GnuPG v1.2.4 (MingW32) iD8DBQFA8XuOsF6jCi4glqMRAuh3AKCX9aqzKBh5i9Nj5SQsMOjDuRLcBgCfWyFl 28onGDE/9u8YlOHXbYqMjH0= =NJ5n -----END PGP MESSAGE----- ------------D81AD301C85E2F5--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?115911306.20040711194031>