[Beignet] [PATCH] add edge case detection for powr in utests

Meng, Mengmeng mengmeng.meng at intel.com
Tue Dec 30 23:43:45 PST 2014


Sorry, there may be something wrong with my git config, so please ignore this mail.

-----Original Message-----
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Meng Mengmeng
Sent: Wednesday, December 31, 2014 11:33 PM
To: beignet at lists.freedesktop.org
Cc: Meng, Mengmeng; Zhu, BingbingX
Subject: [Beignet] [PATCH] add edge case detection for powr in utests

power(x,y) return Nan for x<0 in spec, so add that for powr.

Signed-off-by: Zhu Bingbing <bingbingx.zhu at intel.com>
---
 utests/utest_generator.py | 4 ++--
 utests/utest_math_gen.py  | 5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/utests/utest_generator.py b/utests/utest_generator.py index 4aa0444..c18972a 100644
--- a/utests/utest_generator.py
+++ b/utests/utest_generator.py
@@ -54,8 +54,8 @@ Single_Precision_ULPs={'acos' : '4' ,
                       'nan' : '0' ,
                       'nextafter' : '0' ,
                       'pow' : '16' ,
-                      'pown,' : '16' ,
-                      'powr,' : '16' ,
+                      'pown' : '16' ,
+                      'powr' : '16' ,
                       'remainder' : '0' ,
                       'remquo' : '0' ,
                       'rint' : '-1' ,
diff --git a/utests/utest_math_gen.py b/utests/utest_math_gen.py index 75926b6..71a031f 100755
--- a/utests/utest_math_gen.py
+++ b/utests/utest_math_gen.py
@@ -462,7 +462,10 @@ static float pown(float x, int y){
   powr_output_type = ['float','float2','float4','float8','float16']
   powr_cpu_func='''
 static float powr(float x, int y){
-    return powf(x,y);
+    if (x<0)
+        return NAN;
+    else
+        return powf(x,y);
 } '''
   powrUtests = func('powr','powr',[powr_input_type1,powr_input_type2],powr_output_type,[powr_input_values1,powr_input_values2],'16 * FLT_ULP', powr_cpu_func)
   
--
1.8.5.3

_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list