don't use isnormal() to test for crazy FP numbers

it fails for 0.0 and for subnormal numbers, thanks Murat Korkmazov
This commit is contained in:
John Cupitt 2015-02-04 15:13:11 +00:00
parent 9d8080c266
commit 0c466b9495
2 changed files with 7 additions and 3 deletions

View File

@ -17,6 +17,7 @@
- add VInterpolate class to cplusplus binding, thanks Lovell
- add lower-level operation cache access
- turn on leak testing in test suite
- don't use isnormal() to test for crazy FP numbers, thanks Murat
24/12/14 started 7.42.1
- add gobject-2.0 to Requires: in vips and vips-cpp .pc files

View File

@ -269,10 +269,13 @@ vips_col_scRGB2sRGB( int range, int *lut,
/* XYZ can be Nan, Inf etc. Throw those values out, they will break
* our clipping.
*
* Don't use isnormal(), it is false for 0.0 and for subnormal
* numbers.
*/
if( !isnormal( R ) ||
!isnormal( G ) ||
!isnormal( B ) ) {
if( isnan( R ) || isinf( R ) ||
isnan( G ) || isinf( G ) ||
isnan( B ) || isinf( B ) ) {
*r = 0;
*g = 0;
*b = 0;