Hello,
I've spotted a couple of comparison issues in gawk 4.1.4 that need to be fixed.
1. A NaN is never equal to anything - including another NaN. The following illustrate the problem
BEGIN {
nan = 0 * 1e400
print nan # nan
print nan == nan # 1 should be 0
}
2. Array indices should always be treated as strings - including nil (undefined) values. The following code illustrates the issue.
BEGIN {
a[i] = "null" # i is initially undefined
for (i in a) { # i is null string
print length(i), a[i] # 0 null
print i==0, i=="" # 1 1 should be 0 1
}
print a[""] # null
print a[0] #
}
The nil (uninitialized) value compares true with zero and the null string but the null string should compare false with zero.
print v == 0 # 1 v is not set
print v == "" # 1
print 0 == "" # 0
is undefined and not the null string. i should be set by the array loop to null.
Thanks. Dan.