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: "Mo McKinlay" <mmckinlay at gnu dot org>, "Horst von Brand" <vonbrand at inf dot utfsm dot cl>
- Subject: Re: printf("%0.0f", 0.5) yields unexpected result (0)
- From: "Tim Prince" <tprince at computer dot org>
- Date: Thu, 17 Aug 2000 10:44:22 -0700
- Cc: "Marc Boeren" <M dot Boeren at guidance dot nl>, <gcc-bugs at gcc dot gnu dot org>
- References: <Pine.LNX.4.21.0008161621160.3235-100000@sphere.man.uk.ekto.org>
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.
Tim Prince
----- Original Message -----
From: "Mo McKinlay" <mmckinlay@gnu.org>
To: "Horst von Brand" <vonbrand@inf.utfsm.cl>
Cc: "Marc Boeren" <M.Boeren@guidance.nl>; <gcc-bugs@gcc.gnu.org>
Sent: Thursday, August 17, 2000 8:23 AM
Subject: Re: printf("%0.0f", 0.5) yields unexpected result (0)
>
> # Round to next even digit if .5, what's strange about that?
>
> I don't know what school you guys went to, but I was always taught to
> round up to the next number, not the next *even* number. I may be
being
> incredibly stupid, but where on earth did the ISO committee get this
> behaviour from? I've never heard of next-even-number-rounding before
in my
> life :)
>
> [Yah, I know this is veering OT, replies in private mail, etc]
>
> --
> Mo McKinlay Chief Software Architect inter/open
Labs
> ----------------------------------------------------------------------
---
> GnuPG Key: pub 1024D/76A275F9 2000-07-22 Mo McKinlay
<mmckinlay@gnu.org>
>
>
>
>
>
>