6#include <QtCore/QtMath>
139 operator double()
const;
161 static double GetRounded(
double value,
int precision = 2);
162 static bool IsRoundedEqual(
double value1,
double value2,
int precision = 2);
165 static double GetRoundedUp(
double value,
int precision = 2);
166 static bool IsRoundedUpEqual(
double value1,
double value2,
int precision = 2);
185inline CDouble::operator double()
const
187 return GetElement(0);
337 double scale = qPow(10.0, precision);
339 return qFloor(value * scale + 0.5) / scale;
345 double scale = qPow(10.0, precision);
347 return qFloor(value1 * scale + 0.5) == qFloor(value2 * scale + 0.5);
353 double scale = qPow(10.0, precision);
355 return qFloor(value * scale) / scale;
361 double scale = qPow(10.0, precision);
363 return qFloor(value1 * scale) == qFloor(value2 * scale);
369 double scale = qPow(10.0, precision);
371 return qCeil(value * scale) / scale;
377 double scale = qPow(10.0, precision);
379 return qCeil(value1 * scale) == qCeil(value2 * scale);
385 return qAbs(value1 - value2) <= tolerance;
Wrapper class for double precision floating-point values with rounding utilities.
const CDouble & operator+=(const CDouble &value)
CDouble operator+(const CDouble &value) const
bool operator<(const CDouble &value) const
CDouble operator/(const CDouble &value) const
const CDouble & operator*=(const CDouble &value)
bool IsRoundedUpEqual(const CDouble &value, int precision=2) const
Check if two values are equal after rounding down.
CDouble GetRoundedUp(int precision=2) const
Get rounded down value with specified precision.
bool operator!=(const CDouble &value) const
bool operator>=(const CDouble &value) const
bool IsRoundedDownEqual(const CDouble &value, int precision=2) const
Check if two values are equal after rounding down.
bool operator==(const CDouble &value) const
const CDouble & operator-=(const CDouble &value)
CDouble operator*(const CDouble &value) const
CDouble GetRounded(int precision=2) const
Get rounded value.
bool operator>(const CDouble &value) const
bool IsRoundedEqual(const CDouble &value, int precision=2) const
Check if two values are equal after rounding.
const CDouble & operator=(const CDouble &value)
CDouble GetRoundedDown(int precision=2) const
Get rounded down value with specified precision.
const CDouble & operator/=(const CDouble &value)
bool IsSimiliar(const CDouble &value, double tolerance=I_BIG_EPSILON) const
Check if two values are similiar with specified tolerance.
bool operator<=(const CDouble &value) const
CDouble(double value=0.0)
Implementation of fixed-size mathematical vector with specified type of elements.
const double & operator[](int i) const
TVector< Size, double > operator-() const
void SetElement(int i, const double &value)
Sets the element at the specified index.
const double & GetElement(int i) const
Gets the element at the specified index (read-only).
static const double I_BIG_EPSILON
Package with mathematical functions and algebraical primitives.