NetBSD-Bugs archive

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

standards/59332: awk handling of NaN comparisons



>Number:         59332
>Category:       standards
>Synopsis:       awk handling of NaN comparisons
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 20 03:45:00 +0000 2025
>Originator:     David A. Holland
>Release:        NetBSD 10.99.10 (20240219)
>Organization:
crying on the mountainside
>Environment:
System: NetBSD valkyrie 10.99.10 NetBSD 10.99.10 (VALKYRIE2) #0: Mon Feb 19 02:27:48 EST 2024  dholland@valkyrie:/y/objects/usrobj/sys/arch/amd64/compile/VALKYRIE2 amd64
Architecture: x86_64
Machine: amd64
>Description:

awk recognizes "NaN":

   % echo foo | awk '{ x = "NaN" + 1; print x; }'
   nan

but NaNs are supposed to be unequal to themselves:

   % echo foo | awk '{ x = "NaN" + 1; print (x == x); }'
   1
   % echo foo | awk '{ x = "NaN" + 1; print (x != x); }'
   0
   % echo foo | awk '{ x = "NaN" + 1; print (x <= x); }'
   1

>How-To-Repeat:

As above

>Fix:

probably avoid premature optimization



Home | Main Index | Thread Index | Old Index