author | sl |
Tue, 10 Jun 2014 14:32:02 +0200 | |
changeset 1 | 260cb5ec6c19 |
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