fix utest fail.

Submitted by Luo, Xionghu on Aug. 10, 2015, 8:02 a.m.

Details

Message ID 1439193751-1138-1-git-send-email-xionghu.luo@intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Luo, Xionghu Aug. 10, 2015, 8:02 a.m.
From: Luo Xionghu <xionghu.luo@intel.com>

should use M_180_PI_F to improve the precision.
Signed-off-by: Luo Xionghu <xionghu.luo@intel.com>
---
 utests/compiler_degrees.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/utests/compiler_degrees.cpp b/utests/compiler_degrees.cpp
index 7a17ca7..2079267 100644
--- a/utests/compiler_degrees.cpp
+++ b/utests/compiler_degrees.cpp
@@ -1,5 +1,7 @@ 
 #include "utest_helper.hpp"
 
+#define M_180_PI_F   57.295779513082321F
+
 void compiler_degrees(void)
 {
   const int n = 32;
@@ -24,7 +26,7 @@  void compiler_degrees(void)
 
   OCL_MAP_BUFFER(1);
   for (int i = 0; i < n; ++i) {
-    OCL_ASSERT(((float *)buf_data[1])[i] == src[i] * (180 / 3.141592653589793F));
+    OCL_ASSERT(((float *)buf_data[1])[i] == src[i] * M_180_PI_F);
   }
   OCL_UNMAP_BUFFER(1);
 }

Comments

LGTM, pushed, thanks.

> -----Original Message-----

> From: Beignet [mailto:beignet-bounces@lists.freedesktop.org] On Behalf Of

> xionghu.luo@intel.com

> Sent: Monday, August 10, 2015 16:03

> To: beignet@lists.freedesktop.org

> Cc: Luo, Xionghu

> Subject: [Beignet] [PATCH] fix utest fail.

> 

> From: Luo Xionghu <xionghu.luo@intel.com>

> 

> should use M_180_PI_F to improve the precision.

> Signed-off-by: Luo Xionghu <xionghu.luo@intel.com>

> ---

>  utests/compiler_degrees.cpp | 4 +++-

>  1 file changed, 3 insertions(+), 1 deletion(-)

> 

> diff --git a/utests/compiler_degrees.cpp b/utests/compiler_degrees.cpp

> index 7a17ca7..2079267 100644

> --- a/utests/compiler_degrees.cpp

> +++ b/utests/compiler_degrees.cpp

> @@ -1,5 +1,7 @@

>  #include "utest_helper.hpp"

> 

> +#define M_180_PI_F   57.295779513082321F

> +

>  void compiler_degrees(void)

>  {

>    const int n = 32;

> @@ -24,7 +26,7 @@ void compiler_degrees(void)

> 

>    OCL_MAP_BUFFER(1);

>    for (int i = 0; i < n; ++i) {

> -    OCL_ASSERT(((float *)buf_data[1])[i] == src[i] * (180 /

> 3.141592653589793F));

> +    OCL_ASSERT(((float *)buf_data[1])[i] == src[i] * M_180_PI_F);

>    }

>    OCL_UNMAP_BUFFER(1);

>  }

> --

> 1.9.1

> 

> _______________________________________________

> Beignet mailing list

> Beignet@lists.freedesktop.org

> http://lists.freedesktop.org/mailman/listinfo/beignet