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: Zhizhou Zhang
Subject: Re: [bug-gawk] option --non-decimal-data discard lowest 8 bits
Date: Mon, 6 Feb 2017 16:35:17 +0800

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]