[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Stale cache of MPFR formatted+rounded strings
From: |
arnold |
Subject: |
Re: [bug-gawk] Stale cache of MPFR formatted+rounded strings |
Date: |
Mon, 01 Jan 2018 22:24:13 -0700 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
I have patches that fix this. I will post them once I have had
a chance to test against all the test cases you sent.
Thanks,
Arnold
address@hidden wrote:
> Thanks for the report. The dev team will think about this.
>
> Thanks,
>
> Arnold
>
> Nethox <address@hidden> wrote:
>
> > Compiled from the tarball on GNU/Linux x86:
> > $ gawk -V | head -1
> > GNU Awk 4.2.0, API: 2.0 (GNU MPFR 3.1.5, GNU MP 6.1.2)
> >
> > Minimal reproducible test:
> > $ cat mpfrrndeval.min.awk
> > BEGIN {
> > pi = 3.1416
> > OFMT = "%.f"
> > print pi # ROUNDMODE = "N" by default.
> > ROUNDMODE = "U"
> > print pi
> > }
> > $ gawk -M -f ./mpfrrndeval.min.awk
> > 3
> > 3
> > $ cat mpfrrndeval.min.ok
> > 3
> > 4
> >
> > GAWK seems to cache the MPFR formatted+rounded string for each variable
> > printed with OFMT or CONVFMT (not printf). However, this cache is not
> > discarded when ROUNDMODE is assigned to a different mode, so only the first
> > printing is correct for certain.
> > Workarounds: reassigning pi=3.1416 or pi=pi+0 before every print
> > evaluation; reassigning OFMT/CONVFMT to a different precision before every
> > print evaluation; replacing each print lvalue argument with rvalues like
> > the literal 3.1416 or pi+0.
> > Useless things: --lint, --no-optimize.
> >
> > I attach a more complete test and results (filenames without .min).
> >
> > Regards.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [bug-gawk] Stale cache of MPFR formatted+rounded strings,
arnold <=