cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ae9257401e387f1d166c1974eb84edae3284a741

commit ae9257401e387f1d166c1974eb84edae3284a741
Author: Cedric BAIL <[email protected]>
Date:   Mon Dec 19 16:28:10 2016 -0800

    eina: get rid of float comparison warning on quaternion tests.
---
 src/tests/eina/eina_test_quaternion.c | 36 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/tests/eina/eina_test_quaternion.c 
b/src/tests/eina/eina_test_quaternion.c
index 71536e3..c832cb2 100644
--- a/src/tests/eina/eina_test_quaternion.c
+++ b/src/tests/eina/eina_test_quaternion.c
@@ -28,15 +28,13 @@
 
 #include "eina_suite.h"
 
-#define FLOAT_CMP(a, b) (fabs((float)a - (float)b) <= FLT_MIN)
-
 static inline Eina_Bool
 eina_quaternion_cmp(const Eina_Quaternion *a, const Eina_Quaternion *b)
 {
-   if (FLOAT_CMP(a->x, b->x) &&
-       FLOAT_CMP(a->y, b->y) &&
-       FLOAT_CMP(a->z, b->z) &&
-       FLOAT_CMP(a->w, b->w))
+   if (EINA_FLT_CMP(a->x, b->x) &&
+       EINA_FLT_CMP(a->y, b->y) &&
+       EINA_FLT_CMP(a->z, b->z) &&
+       EINA_FLT_CMP(a->w, b->w))
      return EINA_TRUE;
    return EINA_FALSE;
 }
@@ -44,15 +42,15 @@ eina_quaternion_cmp(const Eina_Quaternion *a, const 
Eina_Quaternion *b)
 static inline Eina_Bool
 eina_matrix3_cmp(const Eina_Matrix3 *a, const Eina_Matrix3 *b)
 {
-   if (FLOAT_CMP(a->xx, b->xx) &&
-       FLOAT_CMP(a->xy, b->xy) &&
-       FLOAT_CMP(a->xz, b->xz) &&
-       FLOAT_CMP(a->yx, b->yx) &&
-       FLOAT_CMP(a->yy, b->yy) &&
-       FLOAT_CMP(a->yz, b->yz) &&
-       FLOAT_CMP(a->zx, b->zx) &&
-       FLOAT_CMP(a->zy, b->zy) &&
-       FLOAT_CMP(a->zz, b->zz))
+   if (EINA_FLT_CMP(a->xx, b->xx) &&
+       EINA_FLT_CMP(a->xy, b->xy) &&
+       EINA_FLT_CMP(a->xz, b->xz) &&
+       EINA_FLT_CMP(a->yx, b->yx) &&
+       EINA_FLT_CMP(a->yy, b->yy) &&
+       EINA_FLT_CMP(a->yz, b->yz) &&
+       EINA_FLT_CMP(a->zx, b->zx) &&
+       EINA_FLT_CMP(a->zy, b->zy) &&
+       EINA_FLT_CMP(a->zz, b->zz))
      return EINA_TRUE;
    return EINA_FALSE;
 }
@@ -76,9 +74,9 @@ eina_matrix3_f16p16_cmp(const Eina_Matrix3_F16p16 *a, const 
Eina_Matrix3_F16p16
 static inline Eina_Bool
 eina_point_3d_cmp(const Eina_Point_3D *a, const Eina_Point_3D *b)
 {
-   if (FLOAT_CMP(a->x, b->x) &&
-       FLOAT_CMP(a->y, b->y) &&
-       FLOAT_CMP(a->z, b->z))
+   if (EINA_FLT_CMP(a->x, b->x) &&
+       EINA_FLT_CMP(a->y, b->y) &&
+       EINA_FLT_CMP(a->z, b->z))
      return EINA_TRUE;
    return EINA_FALSE;
 }
@@ -101,7 +99,7 @@ START_TEST(eina_test_quaternion_norm)
 
    eina_init();
 
-   fail_if(!FLOAT_CMP(result, sqrt(51)));
+   fail_if(!EINA_FLT_CMP(result, sqrt(51)));
 
    eina_shutdown();
 }

-- 


Reply via email to