[Beignet] [PATCH] Refine calculation for ULP.

Yang, Rong R rong.r.yang at intel.com
Mon Jan 6 19:27:49 PST 2014


LGTM, thanks.

-----Original Message-----
From: Sun, Yi 
Sent: Monday, January 06, 2014 4:52 PM
To: beignet at lists.freedesktop.org; Yang, Rong R
Cc: Sun, Yi
Subject: [Beignet][PATCH] Refine calculation for ULP.

Signed-off-by: Yi Sun <yi.sun at intel.com>
---
 utests/utest_helper.cpp |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp index a738599..91633f0 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -664,14 +664,15 @@ typedef union
 
 const float cl_FLT_ULP(float float_number)  {
-  SF floatBin, ulpBin;
+  SF floatBin, ulpBin, ulpBinBase;
   floatBin.f = float_number;
 
-  ulpBin.spliter.sign = floatBin.spliter.sign;
-  ulpBin.spliter.exponent = floatBin.spliter.exponent;
+  ulpBin.spliter.sign     = ulpBinBase.spliter.sign     = 0;
+  ulpBin.spliter.exponent = ulpBinBase.spliter.exponent = 
+ floatBin.spliter.exponent;
   ulpBin.spliter.mantissa = 0x1;
+  ulpBinBase.spliter.mantissa = 0x0;
   
-  return ulpBin.f;
+  return ulpBin.f - ulpBinBase.f;
 }
 
 const int cl_INT_ULP(int int_number)
--
1.7.6.4



More information about the Beignet mailing list