[Beignet] [PATCH v2] add edge case detection for powr in utests
Meng Mengmeng
mengmeng.meng at intel.com
Wed Dec 31 00:08:55 PST 2014
power(x,y) return NaN for x<0 in spec 1.2, so add that for powr.
Signed-off-by: Meng Mengmeng <mengmeng.meng 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
More information about the Beignet
mailing list