bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] big number calculation


From: Aharon Robbins
Subject: Re: [bug-gawk] big number calculation
Date: Tue, 07 Aug 2012 22:58:16 +0300
User-agent: Heirloom mailx 12.4 7/29/08

Hello. Re this:

> Date: Mon, 6 Aug 2012 14:05:33 +0800
> From: Chen Feng <address@hidden>
> To: address@hidden
> Subject: [bug-gawk] big number calculation
>
> Hi there;
>
> I've encountered such problem:
>
> awk 'BEGIN{
>         print 2**56;
>         print 72057594037927936 + 85;
> }'
>
> the result should be:
> 72057594037927936
> 72057594037928021
>
> but unfortunately the actual result is:
> 72057594037927936
> 72057594037928016
>
> I think there could be something wrong with the big number calculation in
> GNU-Awk.
> -- 
> Thanks,
> Chen
> [ address@hidden ]

You don't state what version you're using.

In any case, it's not a bug, as gawk does not support big numbers. All
numerical operations are done in double precision floating point. This
is the way it's always been and how it's documented to work.

(I'm curious why you expect big number support?  You're not the first
one...)

The next major release will support MPFR but that will have to be enabled
via command line option or special variable. It will not be the default.

Thanks,

Arnold



reply via email to

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