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

[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: Wed, 21 Dec 2005 16:58:00 -0500
User-agent: Mutt/1.4.1i

On Wed, Dec 21, 2005 at 04:34:19PM -0500, Andrew J. Schorr wrote:
> Just out of curiosity, do you know of any actual platforms in use where my
> patch does not work?  I have attached it -- it is considerably smaller
> than your patch...

So I do see one difference in behavior between your patch and mine,
and that's on a Solaris 8 32-bit sparc platform.  Using the test
case:

    gawk --lint 'BEGIN { x=2**60; for(i=60;i<=65;i++) { printf "2^%d= %s %d 
%g\n",i,x,x,x; x*=2}}'

the output from your patch and mine differs as follows:

< gawk: warning: [s]printf: value 1.84467e+19 is out of range for `%d' format
< 2^64= 1.84467e+19 1.84467e+19 1.84467e+19
---
> 2^64= 1.84467e+19 18446744073709551615 1.84467e+19

I guess your patch is more correct, although neither one gives the user
exactly what he was asking for (a proper %d result; my patch is off by 1,
whereas yours gives a warning and prints %g format instead).

Regards,
Andy




reply via email to

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