diff options
author | Ruiling Song <ruiling.song@intel.com> | 2014-12-22 12:27:18 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2014-12-22 12:34:44 +0800 |
commit | 4c82042d261e646092810d27dde998a5ccace998 (patch) | |
tree | bf9e5dfd1e9f90c6fa13e0b39a2fee6d6f3ecf0a | |
parent | 4db0c1241b462f82ac2cd8ece8102129882d9f20 (diff) |
libocl: Correctly handle -inf in exp10.
exp10(-inf) should return 0.0f
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r-- | backend/src/libocl/tmpl/ocl_math.tmpl.cl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/backend/src/libocl/tmpl/ocl_math.tmpl.cl b/backend/src/libocl/tmpl/ocl_math.tmpl.cl index 5d73c163..220f3515 100644 --- a/backend/src/libocl/tmpl/ocl_math.tmpl.cl +++ b/backend/src/libocl/tmpl/ocl_math.tmpl.cl @@ -2709,10 +2709,10 @@ OVERLOADABLE float __gen_ocl_internal_exp10(float x){ P[3] = 2.034649854009453E+000; P[4] = 2.650948748208892E+000; P[5] = 2.302585167056758E+000; - if( isinf(x)) - return INFINITY; - if( x < -MAXL10 )return 0.0; + if( x < -MAXL10 ) return 0.0; + + if( isinf(x)) return INFINITY; /* The following is necessary because range reduction blows up: */ if( x == 0 )return 1.0; |