bug-gawk
[Top][All Lists]
Advanced

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

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


From: John Haque
Subject: Re: [bug-gawk] How does awk implement extremely long integers?
Date: Wed, 1 Feb 2012 09:14:47 -0600
User-agent: Mutt/1.4.2.2i

Hi.

On Tue, Jan 31, 2012 at 10:53:30AM -0700, Nelson H. F. Beebe wrote:
 
> 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
> 
>       http://www.math.utah.edu/pub/mathcw/

I assume the modified gcc has additional format specifiers to print
"long" integers?

The GNU mpfr library does not have any built-in facility
to output "long" integers  what I tell after looking at the online
doc. BTW, if I am not mistaken, gawk used to print long integers as
floating point numbers in the old days. Is this going to be an issue
for gawk?

$ gawk --version
GNU Awk 3.1.5

$ gawk 'BEGIN { print 1000*342413245}'
3.42413e+11


Thanks,

John



reply via email to

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