Cycles: FIx issue with -0 being considered a non-finite value

This commit is contained in:
Sergey Sharybin 2017-08-24 14:32:56 +02:00
parent 1fb2637006
commit 436d1b4e90

@ -224,7 +224,7 @@ ccl_device_inline bool isfinite_safe(float f)
{ {
/* By IEEE 754 rule, 2*Inf equals Inf */ /* By IEEE 754 rule, 2*Inf equals Inf */
unsigned int x = __float_as_uint(f); unsigned int x = __float_as_uint(f);
return (f == f) && (x == 0 || (f != 2.0f*f)) && !((x << 1) > 0xff000000u); return (f == f) && (x == 0 || x == (1 << 31) || (f != 2.0f*f)) && !((x << 1) > 0xff000000u);
} }
ccl_device_inline float ensure_finite(float v) ccl_device_inline float ensure_finite(float v)