[Top][All Lists]

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

Re: [bug-gawk] How does awk implement extremely long integers?

From: Nelson H. F. Beebe
Subject: Re: [bug-gawk] How does awk implement extremely long integers?
Date: Tue, 31 Jan 2012 10:53:30 -0700 (MST)

Peng Yu <address@hidden> asks about the size of an integer
in gawk.

All gawk implementations (gawk, nawk, awk, mawk, tawk, jawk, ...) by
default use a numeric type implemented as a double, which on modern
systems is always the IEEE 754 64-bit format.  It has a 53-bit
significand, with a separate sign, so numbers in the range
[0, 2**53 - 1] can be represented exactly.

For the applications for which awk was intended, that is mostly adequate.
I have private versions of mawk and nawk that have been extended for
80-bit and 128-bit long double IEEE 754 formats, and also for 128-bit
IEEE 754-2008 decimal arithmetic.  See


if you want to experiment with extended arithmetic in awk.

- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: address@hidden  -
- 155 S 1400 E RM 233                       address@hidden  address@hidden -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -

reply via email to

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