forked from enlightenment/efl
eina: add functions for warningless exact comparisons of floats
in some cases a user does want to check exact values, so these functions should be used to indicate this intent needs windows support @feature
This commit is contained in:
parent
6cf290faec
commit
1b4c26be8e
|
@ -100,3 +100,35 @@ eina_environment_tmp_get(void)
|
|||
return tmp;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#elif defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wfloat-equal"
|
||||
#elif defined(__GNUC__)
|
||||
# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
EAPI Eina_Bool
|
||||
eina_dbleq(double a, double b)
|
||||
{
|
||||
return a == b;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
eina_flteq(float a, float b)
|
||||
{
|
||||
return a == b;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#elif defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#elif defined(__GNUC__)
|
||||
# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
|
||||
# pragma GCC diagnostic pop
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -49,6 +49,26 @@ EAPI const char *eina_environment_home_get(void);
|
|||
*/
|
||||
EAPI const char *eina_environment_tmp_get(void);
|
||||
|
||||
/**
|
||||
* @brief Warningless comparison of doubles using ==
|
||||
* @param a First member to compare
|
||||
* @param b Second member to compare
|
||||
*
|
||||
* @return @c true if two doubles match
|
||||
* @since 1.19
|
||||
*/
|
||||
EAPI Eina_Bool eina_dbleq(double a, double b);
|
||||
|
||||
/**
|
||||
* @brief Warningless comparison of floats using ==
|
||||
* @param a First member to compare
|
||||
* @param b Second member to compare
|
||||
*
|
||||
* @return @c true if two floats match
|
||||
* @since 1.19
|
||||
*/
|
||||
EAPI Eina_Bool eina_flteq(float a, float b);
|
||||
|
||||
/**
|
||||
* @brief Safe comparison of float
|
||||
* @param a First member to compar
|
||||
|
|
Loading…
Reference in New Issue