
compare to NaN is not working

Callisto
function test() variable k = NaN if (k== NaN) print "NaN" else print "not NaN" endif end
Why does the above result in a "not NaN"? I have to use str2num() and this will return a NaN if it was not successful.
Any ideas?
August 21, 2013 at 10:41 am - Permalink
See also IEEE754 standard.
August 21, 2013 at 11:46 am - Permalink
It's not supposed to work. NaN is actually specified by an IEEE standard for floating point numbers. Other scientific software packages like Matlab and Labview similarly return false for that type of comparison. Your suggestion is the "proper" way to check in Igor.
August 21, 2013 at 11:46 am - Permalink
August 21, 2013 at 04:59 pm - Permalink