forked from enlightenment/efl
eina: add general purpose function to compar float and double.
This commit is contained in:
parent
00f8cc4566
commit
7bb229d4be
|
@ -19,6 +19,8 @@
|
|||
#ifndef EINA_UTIL_H_
|
||||
#define EINA_UTIL_H_
|
||||
|
||||
#include <float.h>
|
||||
|
||||
/**
|
||||
* @addtogroup Eina_Tools_Group Tools
|
||||
*
|
||||
|
@ -47,6 +49,24 @@ EAPI const char *eina_environment_home_get(void);
|
|||
*/
|
||||
EAPI const char *eina_environment_tmp_get(void);
|
||||
|
||||
/**
|
||||
* @brief Safe comparison of float
|
||||
* @param a First member to compar
|
||||
* @param b Second member to compar
|
||||
*
|
||||
* @return @c true if two floats match
|
||||
*/
|
||||
#define EINA_FLT_CMP(a, b) (fabsf((float)a - (float)b) <= FLT_EPSILON)
|
||||
|
||||
/**
|
||||
* @brief Safe comparison of double
|
||||
* @param a First member to compar
|
||||
* @param b Second member to compar
|
||||
*
|
||||
* @return @c true if two double match
|
||||
*/
|
||||
#define EINA_DBL_CMP(a, b) (fabs((double)a - (double)b) <= DBL_EPSILON)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue