bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] option --non-decimal-data discard lowest 8 bits


From: arnold
Subject: Re: [bug-gawk] option --non-decimal-data discard lowest 8 bits
Date: Mon, 06 Feb 2017 06:04:54 -0700
User-agent: Heirloom mailx 12.4 7/29/08

Glad to help.

Enjoy,

Arnold

Zhizhou Zhang <address@hidden> wrote:

> Hi Arnold,
>
> I see. Thank you very much!
>
> On Mon, Feb 6, 2017 at 4:22 PM,  <address@hidden> wrote:
> > Hi.
> >
> > Thanks for submitting a report.
> >
> > As you surmise, this is a (documented!) limitation of awk's use of double
> > precision floating point numbers.
> >
> > You can use the -M option to supply more bits of precision, if your
> > version of gawk was compiled with MPFR support.
> >
> > Thanks,
> >
> > Arnold
> > Zhizhou Zhang <address@hidden> wrote:
> >
> >> Hi,
> >>
> >> I'm using gawk 4.1.4. I found a problem with --non-decimal-data. It's
> >> shown below:
> >>
> >> $ cat a
> >> 0x1111222233334444
> >> $ cat a | gawk --non-decimal-data '{printf( "0x%x\n", $0)}'
> >> 0x1111222233334400
> >>
> >> As it is, the lowest 8 bits 0x44 is discarded. I had a glance over the
> >> source code, It seems because of AWKNUM is float type, which reserved
> >> some bits for exponent part.
> >>
> >> #define AWKNUM  double
> >>
> >> Is this a known issue? I'm not sure whether it is a bug, I hope I
> >> haven't bothered you too much.
> >>
> >> --
> >> Regards,
> >> Zhizhou
>
>
>
> -- 
> Regards,
> Zhizhou



reply via email to

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