diff options
author | Yi Sun <yi.sun@intel.com> | 2014-01-06 16:51:52 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2014-01-07 16:39:13 +0800 |
commit | 3f44e60a6a7b18c9b8ba171391f2273b090c5303 (patch) | |
tree | 9f5c03af6340deee3ae943dde70e127f7451859d /utests/utest_helper.cpp | |
parent | 5bb1a15c76269624705857ab5bc4734421b0bf27 (diff) |
Refine calculation for ULP.
Signed-off-by: Yi Sun <yi.sun@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Diffstat (limited to 'utests/utest_helper.cpp')
-rw-r--r-- | 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 a7385997..91633f0a 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) |