This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: printf("%0.0f", 0.5) yields unexpected result (0)
- To: Tim Prince <tprince at computer dot org>
- Subject: Re: printf("%0.0f", 0.5) yields unexpected result (0)
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Thu, 17 Aug 2000 21:40:02 +0200
- CC: Mo McKinlay <mmckinlay at gnu dot org>,Horst von Brand <vonbrand at inf dot utfsm dot cl>,Marc Boeren <M dot Boeren at guidance dot nl>, gcc-bugs at gcc dot gnu dot org
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <Pine.LNX.4.21.0008161621160.3235-100000@sphere.man.uk.ekto.org> <015501c00875$ec841990$0100000a@TIMYX18EWDT6RQ>
Tim Prince wrote:
[ Q: Why round to nearest even ?
A: To forgo bias in rounding down or up always ]
> This rounding to nearest even procedure was adopted long ago in the
> IEEE-P754 standard, after much research. It is the native behavior of
> nearly all floating point chips designed over the last 20 years. The
> Fortran standard perpetuates potentially serious performance problems by
> insisting on the older style of rounding.
Note that active Standard Development is gearing towards giving Fortran
(200x) enough expressiveness to include support for IEEE-754, if the
processor supports it.
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://g95.sourceforge.net/ (under construction)