author | sl@SLION-WIN7.fritz.box |
Fri, 15 Jun 2012 03:10:57 +0200 | |
changeset 0 | bde4ae8d615e |
permissions | -rw-r--r-- |
1 #ifndef __MATH_AUX_H
2 #define __MATH_AUX_H
4 #include <limits>
6 /*
7 * This function is not only used to compare floating point values with a tolerance,
8 * it also leads to ambiguity problems if the called functions do not have the
9 * right prototype.
10 */
11 template <class _Tp>
12 bool are_equals(_Tp val, _Tp ref) {
13 if (val < ref) {
14 return (ref - val) <= std::numeric_limits<_Tp>::epsilon();
15 }
16 else {
17 return (val - ref) <= std::numeric_limits<_Tp>::epsilon();
18 }
19 }
21 #endif // __MATH_AUX_H