bug-gawk
[Top][All Lists]
Advanced

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

Re: complie with mpfr support


From: arnold
Subject: Re: complie with mpfr support
Date: Thu, 11 Feb 2021 02:48:56 -0700
User-agent: Heirloom mailx 12.5 7/5/10

Hi.

Ivan Molineris <ivan.molineris@gmail.com> wrote:

> Arnold pointed me to the PERC variable. The unexpected behavior that now

PREC :-)

> seems solved with -M, is only shifted to a smaller number.
>
> $ echo 1.8e-508 | gawk -M '$1<0.05 {print "true"}'
> does not print true
>
> So my question is: what is the biggest number that will fail the above
> test, even if in theory is lower than 0.05?

MPFR provides arbitrary precision, based on the setting of PREC.
So I don't think there is a single answer to your question.

MPFR is not a panacea, nor is it magical. You need to understand
floating point math to understand how it works. The gawk manual has
some explicative text, but it is probably not enough, since I don't
have a deep understanding of these issues.

If you want "bignums" you may be better off using Python and one
of its packages than MPFR and gawk.

MPFR support was contributed by a developer who left the project 8+
years ago. In retrospect, adding it was a mistake. But it's too late to
remove it, so I do the best I can to make it work well.

Sorry,

Arnold



reply via email to

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