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: Tue, 7 Aug 2018 08:25:50 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

FYI we now have related tickets at the Open Group (https://help.opengroup.org/hc/en-us/requests/193457) and the Austin Group (http://austingroupbugs.net/view.php?id=1198). The Open Group one only staff can see, the Austin Group one is visible to anyone but requires a login to comment on.

    Ed.

On 8/5/2018 7:05 AM, Ed Morton wrote:
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]