35 #ifndef OPENMS_MATH_MISC_MATHFUNCTIONS_H 
   36 #define OPENMS_MATH_MISC_MATHFUNCTIONS_H 
   64       return (ceil(x / pow(10.0, decPow))) * pow(10.0, decPow); 
 
   80         return (floor(0.5 + x / pow(10.0, decPow))) * pow(10.0, decPow);
 
   82       return -((floor(0.5 + fabs(x) / pow(10.0, decPow))) * pow(10.0, decPow));
 
   92       return left2 + (x - left1) * (right2 - left2) / (right1 - left1);
 
  116       return pow(10, x) - 1;
 
  134     template <
typename T>
 
  139         return T(floor(x + T(0.5)));
 
  143         return T(ceil(x - T(0.5)));
 
  154       return std::fabs(a - b) <= tol;
 
  165     template <
typename T>
 
  190     template <
typename T>
 
  191     T 
gcd(T a, T b, T & u1, T & u2)
 
  223 #endif // OPENMS_MATH_MISC_MATHFUNCTIONS_H 
bool isOdd(UInt x)
Returns true if the given interger is odd. 
Definition: MathFunctions.h:124
static double intervalTransformation(double x, double left1, double right1, double left2, double right2)
transforms point x of interval [left1,right1] into interval [left2,right2] 
Definition: MathFunctions.h:90
T round(T x)
Rounds the value. 
Definition: MathFunctions.h:135
static double ceilDecimal(double x, int decPow)
rounds x up to the next decimal power 10 ^ decPow 
Definition: MathFunctions.h:62
T gcd(T a, T b)
Returns the greatest common divisor (gcd) of two numbers by applying the Euclidean algorithm...
Definition: MathFunctions.h:166
double log2linear(double x)
Transforms a number from log10 to to linear scale. Subtracts the 1 added by linear2log(double) ...
Definition: MathFunctions.h:114
static bool approximatelyEqual(DoubleReal a, DoubleReal b, DoubleReal tol)
Returns if a is approximately equal b , allowing a tolerance of tol. 
Definition: MathFunctions.h:152
static double roundDecimal(double x, int decPow)
rounds x to the next decimal power 10 ^ decPow 
Definition: MathFunctions.h:77
double linear2log(double x)
Transforms a number from linear to log10 scale. Avoids negative logarithms by adding 1...
Definition: MathFunctions.h:102