bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] inside awk script check that -M/--bignum given on command


From: Jannick
Subject: Re: [bug-gawk] inside awk script check that -M/--bignum given on command line?
Date: Fri, 5 Jan 2018 03:04:01 +0100

Hi Andrew,

Thank you for the quick response.

On Thu, 4 Jan 2018 18:20:48 -0500, Andrew J. Schorr wrote:

> > Is there any way (1) to run a check inside the script that the
> > -M/--bignum flag was provided on the command line (if negative exit my
> > script) or (2) to switch on/off the bignum mode inside the script
> > (like IGNORECASE=1 or =0; I wouldn't mind if it could be switched on
only)?

> This issue has arisen in the past. There is a section in the documentation
> about this:
> 
> https://www.gnu.org/software/gawk/manual/html_node/Checking-for-
> MPFR.html

>      BEGIN {
>          # How many bits of mantissa precision are required
>          # for this program to function properly?
>          fpbits = 123

> Does this solve your problem?

Absolutely ... in the first place. Up to now I was looking at the pdf
documentation of gawk 4.1 (Aug 2016) which apparently is a bit outdated and
does not contain this new chapter. So good to rather check the online
documentation. This was the good news part.

I quickly checked the code above which does the job after decreasing fpbits
to 53. The exact version I am working with is GNU Awk 4.2.0, API: 2.0 (GNU
MPFR 3.1.6-p1, GNU MP 6.1.2) which is shipped by cygwin (I am sitting in
front of a Win10 box). Presumably gawk needs to be updated to MPFR 4.0.0
such that everything works properly, however the compilation exercise is not
always pure fun with configure, automake and co.  I will try tomorrow if I
can make my way through the compilation of gmp and mpfr and then finally
gawk.

So all in all, the method does work, however the expected precision is the
issue here.
 
> Regards,
> Andy

Many thanks again!
J.




reply via email to

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