bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: gawk round-up 0.5 bug?


From: Aharon Robbins
Subject: Re: gawk round-up 0.5 bug?
Date: Mon, 29 Sep 2008 07:04:37 +0000 (UTC)

It clearly depends upon the C library, since gawk uses the C library's
sprintf to do the actual formatting. On my Linux system:

$ gawk 'BEGIN { printf ("%.0f\n", 0.5) }'
0
$ gawk --version | head -1
GNU Awk 3.1.6
$ uname -a
Linux aahz 2.6.23.14-64.fc7 #1 SMP Sun Jan 20 23:54:08 EST 2008 i686 i686 i386 
GNU/Linux

Perhaps this should be reported to the Cygwin maintainers.

Arnold

In article <address@hidden>,
Hermann Peifer  <address@hidden> wrote:
>Andreas Schwab <schwab <at> suse.de> writes:
>
>> 
>> Since 0.5 is exactly half-way between 0 and 1 it is rounded to the
>> nearest even number.  This is the default rounding mode for IEEE
>> floating point systems.
>> 
>
>
>By the way...
>
>address@hidden:~]> gawk 'BEGIN {printf("%.0f\n", 0.5)}'
>1
>
>address@hidden:~]> gawk --version|head -1
>GNU Awk 3.1.6
>
>address@hidden:~]> uname -a
>CYGWIN_NT-5.1 LAPTOP7664 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
>
>Hermann
>
>
>
>


-- 
Aharon (Arnold) Robbins                                 arnold AT skeeve DOT com
P.O. Box 354            Home Phone: +972  8 979-0381
Nof Ayalon              Cell Phone: +972 50  729-7545
D.N. Shimshon 99785     ISRAEL




reply via email to

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