[Beignet] [PATCH] libocl: powr(x<0, y) should return NAN.

Ruiling Song ruiling.song at intel.com
Mon Jan 5 18:50:40 PST 2015


Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 backend/src/libocl/tmpl/ocl_math.tmpl.cl |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backend/src/libocl/tmpl/ocl_math.tmpl.cl b/backend/src/libocl/tmpl/ocl_math.tmpl.cl
index 3f296e7..ed26b3c 100644
--- a/backend/src/libocl/tmpl/ocl_math.tmpl.cl
+++ b/backend/src/libocl/tmpl/ocl_math.tmpl.cl
@@ -3508,7 +3508,7 @@ OVERLOADABLE float powr(float x, float y) {
   unsigned int hx, sx, hy, sy;
 
   if (__ocl_math_fastpath_flag)
-    return __gen_ocl_pow(x,y);
+    return x < 0.0f ? NAN : __gen_ocl_pow(x,y);
   else {
     if (isnan(x) || isnan(y)) return NAN;
     GEN_OCL_GET_FLOAT_WORD(hx,x);
-- 
1.7.10.4



More information about the Beignet mailing list