Opened 14 years ago

Closed 14 years ago

#3576 closed defect (fixed)

Better handling of NaN (not a number)

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone: 1.8.0
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

  • It appears that with Microsoft C-Runtime, atof("nan") returns 0 whereas it returns a nan number in Linux. printf("%f", a_nan_floating_point) can return "1.#QNAN", "-1.#QNAN" or "-1#.IND" on Windows, whereas it always returns "nan" on Linux. So the solution is to update CPLStrtodDelim() to handle the "nan" string specially, and be carefull when turning a value into a string by testing with CPLIsNan(). Several places such as gdal_translate, gdalwarp utility, geotiff, PAM and VRT nodata reading&writing needs to be updated in consequence.
  • We also need special code to handle the case where nan is the nodata value when comparing a pixel value to the nodata value, such as GDALWarpNoDataMasker(), GDALNoDataMaskBand class, VRT complex source. This is also the opportunity to extend the use EQUAL_TO_NODATA() that was introduced in r19671

Change History (1)

comment:1 by Even Rouault, 14 years ago

Resolution: fixed
Status: newclosed

Fixed in trunk (r19692). Tests added in r19693

Note: See TracTickets for help on using tickets.