n-Dimensional Fast Methods  0.7
 All Classes Functions Variables Typedefs Pages
utils.h
1 
18 #ifndef UTILS_H_
19 #define UTILS_H_
20 
21 #include <limits>
22 
23 class utils {
24  public:
27  static constexpr double COMP_MARGIN = std::numeric_limits<double>::epsilon() * 1e5;
28 
31  static bool isTimeBetterThan
32  (double t1, double t2) {
33  return t1 + COMP_MARGIN < t2;
34  }
35 
37  static unsigned int absUI
38  (int a) {
39  return (a>0) ? (a) : (-a);
40  }
41 };
42 
43 #endif /* UTILS_H_ */
static unsigned int absUI(int a)
An user-implemented absolute value function for integer values.
Definition: utils.h:38
static bool isTimeBetterThan(double t1, double t2)
Returns true if t1 is at least epsilon-lower than t2, provides robust comparions for doubles...
Definition: utils.h:32
static constexpr double COMP_MARGIN
When comparing doubles if(a < b), do if(a+COMP_MARGIN < b) to avoid double precission issues...
Definition: utils.h:27
Provides helper code not related with specific classes. Copyright (C) 2014 Javier V...
Definition: utils.h:23