|
@@ -19,19 +19,19 @@ using std::stod;
|
|
|
using std::string;
|
|
using std::string;
|
|
|
using std::to_string;
|
|
using std::to_string;
|
|
|
|
|
|
|
|
-Double::Double() : Class(Double::_fetchClassName())
|
|
|
|
|
|
|
+Double::Double() : Class(_fetchClassName())
|
|
|
{
|
|
{
|
|
|
this->_assignEpsilon(0.00000001);
|
|
this->_assignEpsilon(0.00000001);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-Double::Double(double _value) : Class(Double::_fetchClassName()), value(_value)
|
|
|
|
|
|
|
+Double::Double(const double _value) : Class(_fetchClassName()), value(_value)
|
|
|
{
|
|
{
|
|
|
this->_assignEpsilon(0.00000001);
|
|
this->_assignEpsilon(0.00000001);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Double::~Double() noexcept = default;
|
|
Double::~Double() noexcept = default;
|
|
|
|
|
|
|
|
-Double &Double::operator=(double _value)
|
|
|
|
|
|
|
+Double &Double::operator=(const double _value)
|
|
|
{
|
|
{
|
|
|
this->value = _value;
|
|
this->value = _value;
|
|
|
return *this;
|
|
return *this;
|
|
@@ -47,7 +47,7 @@ double Double::operator+(const Double &_double) const
|
|
|
return this->value + _double.getValue();
|
|
return this->value + _double.getValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-double Double::operator+(double _value) const
|
|
|
|
|
|
|
+double Double::operator+(const double _value) const
|
|
|
{
|
|
{
|
|
|
return this->value + _value;
|
|
return this->value + _value;
|
|
|
}
|
|
}
|
|
@@ -57,7 +57,7 @@ double Double::operator*(const Double &_double) const
|
|
|
return this->value * _double.getValue();
|
|
return this->value * _double.getValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-double Double::operator*(double _value) const
|
|
|
|
|
|
|
+double Double::operator*(const double _value) const
|
|
|
{
|
|
{
|
|
|
return this->value * _value;
|
|
return this->value * _value;
|
|
|
}
|
|
}
|
|
@@ -67,7 +67,7 @@ double Double::operator-(const Double &_double) const
|
|
|
return this->value - _double.getValue();
|
|
return this->value - _double.getValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-double Double::operator-(double _value) const
|
|
|
|
|
|
|
+double Double::operator-(const double _value) const
|
|
|
{
|
|
{
|
|
|
return this->value - _value;
|
|
return this->value - _value;
|
|
|
}
|
|
}
|
|
@@ -77,7 +77,7 @@ double Double::operator/(const Double &_double) const
|
|
|
return this->value / _double.getValue();
|
|
return this->value / _double.getValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-double Double::operator/(double _value) const
|
|
|
|
|
|
|
+double Double::operator/(const double _value) const
|
|
|
{
|
|
{
|
|
|
return this->value / _value;
|
|
return this->value / _value;
|
|
|
}
|
|
}
|
|
@@ -88,7 +88,7 @@ Double &Double::operator+=(const Double &_double)
|
|
|
return *this;
|
|
return *this;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-Double &Double::operator+=(double _value)
|
|
|
|
|
|
|
+Double &Double::operator+=(const double _value)
|
|
|
{
|
|
{
|
|
|
this->value += _value;
|
|
this->value += _value;
|
|
|
return *this;
|
|
return *this;
|
|
@@ -100,7 +100,7 @@ Double &Double::operator-=(const Double &_double)
|
|
|
return *this;
|
|
return *this;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-Double &Double::operator-=(double _value)
|
|
|
|
|
|
|
+Double &Double::operator-=(const double _value)
|
|
|
{
|
|
{
|
|
|
this->value -= _value;
|
|
this->value -= _value;
|
|
|
return *this;
|
|
return *this;
|
|
@@ -112,7 +112,7 @@ Double &Double::operator*=(const Double &_double)
|
|
|
return *this;
|
|
return *this;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-Double &Double::operator*=(double _value)
|
|
|
|
|
|
|
+Double &Double::operator*=(const double _value)
|
|
|
{
|
|
{
|
|
|
this->value *= _value;
|
|
this->value *= _value;
|
|
|
return *this;
|
|
return *this;
|
|
@@ -124,7 +124,7 @@ Double &Double::operator/=(const Double &_double)
|
|
|
return *this;
|
|
return *this;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-Double &Double::operator/=(double _value)
|
|
|
|
|
|
|
+Double &Double::operator/=(const double _value)
|
|
|
{
|
|
{
|
|
|
this->value /= _value;
|
|
this->value /= _value;
|
|
|
return *this;
|
|
return *this;
|
|
@@ -135,7 +135,7 @@ bool Double::operator==(const Double &_double) const
|
|
|
return fabs(this->value - _double.getValue()) < this->epsilon;
|
|
return fabs(this->value - _double.getValue()) < this->epsilon;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool Double::operator==(double _value) const
|
|
|
|
|
|
|
+bool Double::operator==(const double _value) const
|
|
|
{
|
|
{
|
|
|
return fabs(this->value - _value) < this->epsilon;
|
|
return fabs(this->value - _value) < this->epsilon;
|
|
|
}
|
|
}
|
|
@@ -145,7 +145,7 @@ bool Double::operator!=(const Double &_double) const
|
|
|
return fabs(this->value - _double.getValue()) >= this->epsilon;
|
|
return fabs(this->value - _double.getValue()) >= this->epsilon;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool Double::operator!=(double _value) const
|
|
|
|
|
|
|
+bool Double::operator!=(const double _value) const
|
|
|
{
|
|
{
|
|
|
return fabs(this->value - _value) >= this->epsilon;
|
|
return fabs(this->value - _value) >= this->epsilon;
|
|
|
}
|
|
}
|
|
@@ -155,7 +155,7 @@ bool Double::operator>(const Double &_double) const
|
|
|
return this->value > _double.getValue();
|
|
return this->value > _double.getValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool Double::operator>(double _value) const
|
|
|
|
|
|
|
+bool Double::operator>(const double _value) const
|
|
|
{
|
|
{
|
|
|
return this->value > _value;
|
|
return this->value > _value;
|
|
|
}
|
|
}
|
|
@@ -165,7 +165,7 @@ bool Double::operator>=(const Double &_double) const
|
|
|
return this->value >= _double.getValue();
|
|
return this->value >= _double.getValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool Double::operator>=(double _value) const
|
|
|
|
|
|
|
+bool Double::operator>=(const double _value) const
|
|
|
{
|
|
{
|
|
|
return this->value >= _value;
|
|
return this->value >= _value;
|
|
|
}
|
|
}
|
|
@@ -175,7 +175,7 @@ bool Double::operator<(const Double &_double) const
|
|
|
return this->value < _double.getValue();
|
|
return this->value < _double.getValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool Double::operator<(double _value) const
|
|
|
|
|
|
|
+bool Double::operator<(const double _value) const
|
|
|
{
|
|
{
|
|
|
return this->value < _value;
|
|
return this->value < _value;
|
|
|
}
|
|
}
|
|
@@ -185,7 +185,7 @@ bool Double::operator<=(const Double &_double) const
|
|
|
return this->value <= _double.getValue();
|
|
return this->value <= _double.getValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool Double::operator<=(double _value) const
|
|
|
|
|
|
|
+bool Double::operator<=(const double _value) const
|
|
|
{
|
|
{
|
|
|
return this->value <= _value;
|
|
return this->value <= _value;
|
|
|
}
|
|
}
|
|
@@ -220,12 +220,12 @@ double Double::getValue() const
|
|
|
return this->value;
|
|
return this->value;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Double::setEpsilon(double _epsilon)
|
|
|
|
|
|
|
+void Double::setEpsilon(const double _epsilon)
|
|
|
{
|
|
{
|
|
|
this->_assignEpsilon(_epsilon);
|
|
this->_assignEpsilon(_epsilon);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Double::_assignEpsilon(double _epsilon)
|
|
|
|
|
|
|
+void Double::_assignEpsilon(const double _epsilon)
|
|
|
{
|
|
{
|
|
|
if (_epsilon <= 0.0)
|
|
if (_epsilon <= 0.0)
|
|
|
{
|
|
{
|