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

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

gawk number to string bug


From: David Ellsworth
Subject: gawk number to string bug
Date: Wed, 14 Dec 2005 18:29:38 -0800

I ran into a bug in how gawk converts numbers into strings.  

Running the program
  BEGIN { print 9223372036854775808 }
prints
  -9223372036854775808
on a 64-bit machine.  On a 32-bit machine, the same program prints out
  9.22337e+18
which is correct.

Note that 9223372036854775808 == 2^63.  Printing out other powers of 2
is OK.

Version details:
  gawk version 3.1.5, freshly downloaded from gnu.org
  gcc (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
  uname -a output:
    Linux pixie 2.6.12-gentoo-r10 #2 SMP Tue Nov 1 03:42:22 PST 2005
    x86_64 Dual Core AMD Opteron(tm) Processor 275 AuthenticAMD GNU/Linux

(the 32-bit example used gawk version 3.1.3)

- David




reply via email to

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