diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-10-01 03:26:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-10-01 03:26:28 +0000 |
commit | 9912b9e939bff35a134c9558093991297990ee53 (patch) | |
tree | 371f920fb62e8253f09d8d8888e813cef122e642 /converter | |
parent | 789a373c953d99d93b16e4568e96face686d59fd (diff) | |
download | netpbm-mirror-9912b9e939bff35a134c9558093991297990ee53.tar.gz netpbm-mirror-9912b9e939bff35a134c9558093991297990ee53.tar.xz netpbm-mirror-9912b9e939bff35a134c9558093991297990ee53.zip |
Deal properly with NaN
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1327 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r-- | converter/other/fitstopnm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/converter/other/fitstopnm.c b/converter/other/fitstopnm.c index 0a1f899b..181a85ce 100644 --- a/converter/other/fitstopnm.c +++ b/converter/other/fitstopnm.c @@ -468,6 +468,9 @@ scanImageForMinMax(FILE * const ifP, double * const dataminP, double * const datamaxP) { + /* Note that a value in the file might be Not-A-Number. We ignore + such entries in computing the minimum and maximum for the image. + */ double dmax, dmin; unsigned int image; pm_filepos rasterPos; @@ -495,8 +498,9 @@ scanImageForMinMax(FILE * const ifP, double val; readVal(ifP, valFmt, &val); if (image == imagenum || multiplane ) { - dmax = MAX(dmax, val); - dmin = MIN(dmin, val); + /* Note: if 'val' is NaN, result is 2nd operand */ + dmax = MAX(val, dmax); + dmin = MIN(val, dmin); } } } |