bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] New multiplication algorighm


From: arnold
Subject: Re: [bug-gawk] New multiplication algorighm
Date: Sun, 21 Apr 2019 08:04:53 -0600
User-agent: Heirloom mailx 12.5 7/5/10

I want to emphasize that awk does NOT use arbitrary length numbers.

By default it uses double precision floating point.  This is what the
POSIX spec requires and what all awks do.

Gawk uses the MPFR library to provide greater precision floating point
values, but you still have to specify how much precsion you want. In no
case is the precision totally arbitrary.

Otherwise, Andy's answer is correct, and Nelson's answer is of note
as well.

Thanks,

Arnold

Peter Brooks <address@hidden> wrote:

> Thank you - that's the answer. I'll ask about the MPFR library.
>
> I asked here because awk uses arbitrary length numbers.
>
> Sent from my iPad
>
> > On 19 Apr 2019, at 17:45, Andrew J. Schorr <address@hidden> wrote:
> > 
> >> On Fri, Apr 19, 2019 at 12:47:33PM +0200, Peter Brooks wrote:
> >> 
> >> I was just wondering if there were any plans to use this new algorithm I 
> >> the future.
> >> 
> >> https://www.sciencealert.com/mathematicians-just-discovered-an-astonishing-new-way-to-multiply-numbers-together
> >> 
> > 
> > That's theoretically interesting, but I don't think it's a gawk issue. If 
> > I'm
> > not mistaken, gawk multiplies numbers either by using the CPU's built-in
> > multiplication capability for integer or floating-point values, or by using 
> > a
> > compiler algorithm if the CPU doesn't directly support multiplying the 
> > types in
> > question, or by using the mpfr library when -M is used.  So if this new
> > algorithm is to be used, it will have to be implemented in the CPU, the C
> > compiler, or the MPFR library. I think the only place this might be
> > relevant is in the MPFR library for handling very large numbers...
> > 
> > Regards,
> > Andy
>



reply via email to

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