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