[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gawk number to string bug
From: |
Andrew J. Schorr |
Subject: |
Re: gawk number to string bug |
Date: |
Fri, 23 Dec 2005 17:20:57 -0500 |
User-agent: |
Mutt/1.4.1i |
I thought of another issue. Currently, gawk has the following behavior:
$ gawk 'BEGIN {printf "%d\n",-.4}'
-0
And this behavior is the same with the patch I just sent.
But my patch differs for this case:
$ ./gawk 'BEGIN {printf "%d\n",-0.0}'
-0
Versus standard (unpatched) gawk:
$ gawk 'BEGIN {printf "%d\n",-0.0}'
0
Is it clear what the proper behavior should be in such cases? Is it
well defined? It seems like a regression test could be useful to
cover this issue...
Also, there are rounding differences between my current patch and
standard gawk:
Unpatched:
$ gawk 'BEGIN {printf "%d\n",-.9}'
-0
Patched:
$ ./gawk 'BEGIN {printf "%d\n",-.9}'
-1
So do we need to truncate before calling snprintf("%.0f")? Is it well-defined
what happens when a non-integral value is printed using "%d" in gawk?
Regards,
Andy
- Re: gawk number to string bug, (continued)
- Re: gawk number to string bug, Paul Eggert, 2005/12/21
- Re: gawk number to string bug, Andrew J. Schorr, 2005/12/21
- Re: gawk number to string bug, Andrew J. Schorr, 2005/12/21
- Re: gawk number to string bug, Andrew J. Schorr, 2005/12/21
- Re: gawk number to string bug, Paul Eggert, 2005/12/21
- Re: gawk number to string bug, Andrew J. Schorr, 2005/12/22
- Re: gawk number to string bug, Andrew J. Schorr, 2005/12/23
- Re: gawk number to string bug, Andrew J. Schorr, 2005/12/23
- Re: gawk number to string bug,
Andrew J. Schorr <=
- Re: gawk number to string bug, Andrew J. Schorr, 2005/12/23
- Re: gawk number to string bug, Eli Zaretskii, 2005/12/24
- Re: gawk number to string bug, Andrew J. Schorr, 2005/12/24
- Re: gawk number to string bug, Eli Zaretskii, 2005/12/24
- Re: gawk number to string bug, Paul Jarc, 2005/12/24
- Re: gawk number to string bug, Paul Eggert, 2005/12/25
- Message not available
- Re: gawk number to string bug, Jürgen Kahrs, 2005/12/24
- Re: gawk number to string bug, Eli Zaretskii, 2005/12/25
- Re: gawk number to string bug, Andrew J. Schorr, 2005/12/25
- Re: gawk number to string bug, Paul Eggert, 2005/12/25