1 #ifndef __MATH_AUX_H
2 #define __MATH_AUX_H
3 
4 #include <limits>
5 
6 #undef __STD
7 #if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
8 #  define __STD std::
9 #else
10 #  define __STD
11 #endif
12 
13 /*
14  * This function is not only used to compare floating point values with a tolerance,
15  * it also leads to ambiguity problems if the called functions do not have the
16  * right prototype.
17  */
18 template <class _Tp>
are_equals(_Tp val,_Tp ref)19 bool are_equals(_Tp val, _Tp ref) {
20   if (val < ref) {
21     return (ref - val) <= __STD numeric_limits<_Tp>::epsilon();
22   }
23   else {
24     return (val - ref) <= __STD numeric_limits<_Tp>::epsilon();
25   }
26 }
27 
28 #undef __STD
29 
30 #endif // __MATH_AUX_H
31