bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Unstated differences between gawk and POSIX


From: Ed Morton
Subject: Re: [bug-gawk] Unstated differences between gawk and POSIX
Date: Sun, 5 Aug 2018 07:05:15 -0500

Arnold - Thanks for getting back to me. I don’t think anyone’s getting excited 
about this in the slightest and I’ll google how to file an interpretation 
request with the Open Group, thanks for the suggestion.

Ed Morton

> On Aug 5, 2018, at 2:53 AM, address@hidden wrote:
> 
> Hi Ed.
> 
> I saw your earlier note also but have not had time to read the comp.lang.awk
> thred in detail.
> 
> Ed Morton <address@hidden> wrote:
> 
>> OK, so apparently gawk really doesn't behave per the POSIX standard when 
>> comparing numeric-string to numeric-string:
>> 
>> In the Expressions In Awk 
>> <http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html#tag_20_06_13_02>
>>  
>> section POSIX says:
>> 
>>    Comparisons (with the '<', "<=", "!=", "==", '>', and ">=" operators) 
>> shall
>>    be made numerically if both operands are numeric, if one is numeric and 
>> the
>>    other has a string value that is a numeric string, or if one is numeric 
>> and
>>    the other has the uninitialized value. Otherwise, operands shall be
>>    converted to strings as required and a string comparison shall be made
> 
> The text in POSIX is bogus. The intent and prior art are that as soon as one
> operand is a numeric string then a numeric comparison is done. Otherwise
> something as basic as
> 
>    echo 5.0 10.0 | awk '{ print ($1 < $2) }'
> 
> would print 0.
> 
> You might want to file an interpretation request with the Open Group.
> 
> I see no reason to:
> 
> - get excited
> - change gawk's behavior
> - issue any warnings
> - or update any documentation (except maybe POSIX.STD)
> 
> Thanks,
> 
> Arnold




reply via email to

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