bug-gawk
[Top][All Lists]
Advanced

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

Re: complie with mpfr support


From: Wolfgang Laun
Subject: Re: complie with mpfr support
Date: Wed, 10 Feb 2021 05:29:13 +0100

Oops. Too long hours. Here is the Java program:

public class Jiffy {
     public static  void main( String[] args ){
         System.out.printf( "%30.28f\n", Math.nextAfter( 0.05, 0 ) );
     }
}

0.0499999999999999960000000000

Whether this string works in the intended way (whatever that is) depends on
the intricacies of the conversion between the string representation of a
decimal and the machine number.
-W

On Wed, 10 Feb 2021 at 05:14, <arnold@skeeve.com> wrote:

> Thanks.
>
> Note that Ivan asked about 0.05 (5/100) and not 0.5 (1/2)... :-)
>
> Arnold
>
> Wolfgang Laun <wolfgang.laun@gmail.com> wrote:
>
> > The maximum double smaller than 0.5 is:
> > 0.4999999999999999400000000000
> >
> > -W
> >
> > On Tue, 9 Feb 2021 at 17:03, <arnold@skeeve.com> wrote:
> >
> > > Hi.
> > >
> > > Ivan Molineris <ivan.molineris@gmail.com> wrote:
> > >
> > > > Thanks Arnold,
> > > > I now understand that in modern linux distribution the gawk binary is
> > > > compiled by default with MPFR support, and all works well if -M is
> given.
> > > >
> > > > In particular my version is
> > > > GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)
> > >
> > > That's pretty old, but that's a separate issue.
> > >
> > > > And
> > > > $ echo 1.8e-308 | gawk -M '$1<0.05'
> > > > return "1.8e-308" as expected.
> > > >
> > > > With the default PREC, what is the biggest number that will fail the
> > > above
> > > > test, even if in theory is lower than 0.05?
> > >
> > > I don't really know. I'm not an expert on this stuff. Sorry.
> > >
> > > Glad you're straightened out.
> > >
> > > Arnold
> > >
> > >
> >
> > --
> > Wolfgang Laun
>


-- 
Wolfgang Laun


reply via email to

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