[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: |
Tue, 09 Feb 2021 08:30:15 -0700 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Hi.
First, understand that even when MPFR support is compiled in, gawk
does not use it unless you invoke it with the -M option.
Second, even with -M the default precision is 53 bits, the same as
hardware floating-point doubles, so you have to set PREC to an appropriate
value, typically with the -v option.
What is the output of gawk --version from a default installation?
That will tell you if your gawk is compiled with MPFR support or not.
If not, then I suggest building the GMP and MPFR libraries and gawk
itself from source and installing that copy in a place in $PATH where
it will be found first. It's really not that hard to so.
Hope this helps,
Arnold
Ivan Molineris <ivan.molineris@gmail.com> wrote:
> Indeed on Ubuntu gawk seems to be compiled with MPFR support.
>
> I would have thought that, when compiled with MPFR support, a command like
> $ echo 1.8e-308 | gawk '$1<0.05'
> will return "1.8e-308", but is not the case, it returns nothing.
>
> For me is not feasible to modify all my scripts to do something like
> $ echo 1.8e-308 | gawk '$1+0<0.05'
> as a workaround.
>
> Is there a better solution?
>
>
> On Thu, Feb 4, 2021 at 8:55 PM <arnold@skeeve.com> wrote:
>
> > Ivan Molineris <ivan.molineris@gmail.com> wrote:
> >
> > > Hi all,
> > > I would like to avoid problems like this one:
> > >
> > https://stackoverflow.com/questions/20684195/awk-and-numeric-comparison-with-number-less-than-1-7e-308
> > >
> > > If I understood well, if gawk is compiled with mpfr support, invoking it
> > > with -M solve the problem.
> > >
> > > I tried to install mpfr whit
> > > $ conda create -n gawk-compile -c conda-forge mpfr
> > > and to configure ad compile gawk in this environment, but -M is still not
> > > available.
> > > How can I compile gawk with mpfr?
> > >
> > > Regards
> >
> > I have no idea what conda is or how it works. I assume it's on some
> > kind of Linux system?
> >
> > The simplest thing is to comple the GMP and MPFR libraries from
> > source and install then and then compile gawk from source with the
> > standard configure and make recipe.
> >
> > If you're on a Linux system with gawk already installed, maybe it was
> > compiled with MPFR support already? The output of gawk --version will
> > show you the MPFR and GMP versions if so.
> >
> > HTH,
> >
> > Arnold
> >
- complie with mpfr support, Ivan Molineris, 2021/02/04
- Re: complie with mpfr support, arnold, 2021/02/04
- Re: complie with mpfr support, Ivan Molineris, 2021/02/09
- Re: complie with mpfr support,
arnold <=
- Re: complie with mpfr support, Ivan Molineris, 2021/02/09
- Re: complie with mpfr support, arnold, 2021/02/09
- Re: complie with mpfr support, Wolfgang Laun, 2021/02/09
- Re: complie with mpfr support, arnold, 2021/02/09
- Re: complie with mpfr support, Wolfgang Laun, 2021/02/09
- Re: complie with mpfr support, Ivan Molineris, 2021/02/11
- Re: complie with mpfr support, arnold, 2021/02/11
- Re: complie with mpfr support, Ivan Molineris, 2021/02/11
- Re: complie with mpfr support, arnold, 2021/02/11
- Re: complie with mpfr support, Wolfgang Laun, 2021/02/11