bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf("%.0f", 0.5) and round-to-even


From: Jim Meyering
Subject: Re: printf("%.0f", 0.5) and round-to-even
Date: Tue, 30 Sep 2008 11:59:38 +0200

Eric Blake <address@hidden> wrote:
> An interesting question popped up on the bug-gnu-utils list:
> http://lists.gnu.org/archive/html/bug-gnu-utils/2008-09/msg00055.html
>
> POSIX states that with %f, the low-order digit is rounded in an 
> implementation-
> defined manner.  However, since 0.5 is exactly half-way between 0 and 1, and
> most machines default to IEEE round-to-even, should we make the gnulib printf-
> posix check enforce that printf("%.0f", 0.5) outputs "0" per round-to-even
> rules?  If so, then at least cygwin 1.5.x fails this check, by outputting "1".

That sounds like the right way to go.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]