NAN as _FillValue/missing_value

I went to convert my _FillValue to NAN; I found that upon reading data and doing comparisons a false is always returned:

  if (datum[i] == vp->attr->missingValue)  // is always false if nan's

At first I thought I was back in the world of round off hell until I was pointed to:

http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

specifically these lines:

  "A NAN will never return true on a <= comparison," and

"One other complication is that comparisons involving NANs are always supposed to return false, "



I would like to suggest that mention of this be made on the netCDF Best Practices page where you point people to use NAN as the _FillValue.

...then I'd like to whine that I have to retro-fit all my code and double the number of checks for every data point to determine if it's _Fill/missing (...using isnan(3)). :)

--Chris

  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: