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

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

Re: GAWK adding big numbers wrong


From: Aharon Robbins
Subject: Re: GAWK adding big numbers wrong
Date: Mon, 13 May 2002 09:25:14 +0300

> Date: Sun, 12 May 2002 23:03:17 -0700 (PDT)
> From: Paul Eggert <address@hidden>
> To: address@hidden
> CC: address@hidden, address@hidden
> Subject: Re: GAWK adding big numbers wrong
>
> > From: Aharon Robbins <address@hidden>
> > Date: Mon, 13 May 2002 01:29:38 +0300
> > 
> > You have hit a limitation in hardware floating point. Gawk uses
> > double precision floating point numbers.  I suggest that if you need
> > infinite precision, you use dc or bc.
>
> Other possibilities include Scheme, (recent versions of) Python,
> Ruby, and other high-level languages like that.
>
> It would be nice if Gawk implemented infinite-precision arithmetic,
> though admittedly this would require some surgery.

Someone is working on this, using one or more free infinite-precision
libraries.  However, his work is very preliminary, and I don't think I'd
be doing him a favor by announcing it, since it's not available for
download.

The surgery required is significant.  In particular memory management
is a major issue, and I am concerned that a switch to infinite precision
for the _default_ behavior would be a big performance loss.  I'm also
worried about long-term code maintenance issues; I don't want a zillion
ifdefs sprinkled throughout the code.

If these issues can be solved, when the MP work is ready, I'll integrate
it.  If not, it may just be distributed as an officially blessed set of
patches that are kept in sync with the main gawk release.

To summarize: for now, use a different language if you need infinite
precision, but maybe one day you'll be able to do it in gawk.

Arnold



reply via email to

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