[Top][All Lists]

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

Re: gawk number to string bug

From: Paul Eggert
Subject: Re: gawk number to string bug
Date: Mon, 19 Dec 2005 23:46:25 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

David Ellsworth <address@hidden> writes:

> BEGIN { x=2**60; for(i=60;i<=65;i++) { printf "2^%d= %s %d %g\n",i,x,x,x; 
> x*=2}}
> ...
> The 2^64 value for %d is probably also a bug

Yes, very much so.

With my patch, on 64-bit Sparc you get:

2^60= 1152921504606846976 1152921504606846976 1.15292e+18
2^61= 2305843009213693952 2305843009213693952 2.30584e+18
2^62= 4611686018427387904 4611686018427387904 4.61169e+18
2^63= 9.22337e+18 9223372036854775808 9.22337e+18
2^64= 1.84467e+19 18446744073709551615 1.84467e+19
2^65= 3.68935e+19 3.68935e+19 3.68935e+19

which is much more sane.

PS.  The "18446744073709551615" in the above output is incorrect (it's
off by one).  But that's a separate bug, and I can fix it by altering
builtin.c in a way that's similar to the node.c patch I already sent in.

reply via email to

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