bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Invalid result when converting to hex literal


From: arnold
Subject: Re: [bug-gawk] Invalid result when converting to hex literal
Date: Tue, 20 Mar 2018 02:00:03 -0600
User-agent: Heirloom mailx 12.4 7/29/08

That's a fascinating bug; thanks for the report. I will look into it.

Mawk "works as expected" simply because it blindly calls strtod.

Thanks,

Arnold

Steven Penny <address@hidden> wrote:

> Tested with Gawk 4.2.1 and 4.1.4. Hex literals work as expected:
>
>     $ awk 'BEGIN {print 0x21}'
>     33
>
>     $ awk --posix 'BEGIN {print 0x21}'
>     0
>
> However when converting from string to hex literal, you get the opposite of 
> what
> is supposed to happen:
>
>     $ awk 'BEGIN {print +"0x21"}'
>     0
>
>     $ awk --posix 'BEGIN {print +"0x21"}'
>     33
>
> in all examples, you should be getting "33" when not using POSIX. Note that 
> all
> Mawk versions work as expected.
>



reply via email to

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