6#ifndef istd_CDouble_included
7#define istd_CDouble_included
11#include <QtCore/QtMath>
70 operator double()
const;
92 static double GetRounded(
double value,
int precision = 2);
93 static bool IsRoundedEqual(
double value1,
double value2,
int precision = 2);
96 static double GetRoundedUp(
double value,
int precision = 2);
97 static bool IsRoundedUpEqual(
double value1,
double value2,
int precision = 2);
98 static bool IsSimiliar(
double value1,
double value2,
double tolerance = I_BIG_EPSILON);
116inline CDouble::operator double()
const
118 return GetElement(0);
268 double scale = qPow(10.0, precision);
270 return qFloor(value * scale + 0.5) / scale;
276 double scale = qPow(10.0, precision);
278 return qFloor(value1 * scale + 0.5) == qFloor(value2 * scale + 0.5);
284 double scale = qPow(10.0, precision);
286 return qFloor(value * scale) / scale;
292 double scale = qPow(10.0, precision);
294 return qFloor(value1 * scale) == qFloor(value2 * scale);
300 double scale = qPow(10.0, precision);
302 return qCeil(value * scale) / scale;
308 double scale = qPow(10.0, precision);
310 return qCeil(value1 * scale) == qCeil(value2 * scale);
316 return qAbs(value1 - value2) <= tolerance;
Simple wrapper of real value represented as double type.
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)
const double & GetElement(int i) const
Package with mathematical functions and algebraical primitives.