eina: safe guard against macro expension error in EINA_*_EQ

Make sure we are use doubel also also in things like EINA_DBL_EQ(a-b, x+y).
Thanks to Vicent for reporting and Xavi for giving me context.

Reviewed-by: Vincent Torri <vincent.torri@gmail.com>
Differential Revision: https://phab.enlightenment.org/D8049
This commit is contained in:
Stefan Schmidt 2019-02-28 10:08:23 +01:00
parent 53a80761db
commit a405a116c1
1 changed files with 2 additions and 2 deletions

View File

@ -78,7 +78,7 @@ static inline Eina_Bool eina_flt_exact(float a, float b);
*
* @return @c true if two floats match
*/
#define EINA_FLT_EQ(a, b) (!!(fabsf((float)a - (float)b) <= FLT_EPSILON))
#define EINA_FLT_EQ(a, b) (!!(fabsf((float)(a) - (float)(b)) <= FLT_EPSILON))
/**
* @brief Determines if a float is not zero
@ -97,7 +97,7 @@ static inline Eina_Bool eina_flt_exact(float a, float b);
*
* @return @c true if two double match
*/
#define EINA_DBL_EQ(a, b) (!!(fabs((double)a - (double)b) <= DBL_EPSILON))
#define EINA_DBL_EQ(a, b) (!!(fabs((double)(a) - (double)(b)) <= DBL_EPSILON))
/**
* @brief Determines if a double is not zero