Base: improve base python object number protocol
This commit is contained in:
@@ -156,7 +156,8 @@ Quantity Quantity::pow(const Quantity &p) const
|
||||
Quantity Quantity::pow(double p) const
|
||||
{
|
||||
return Quantity(
|
||||
std::pow(this->_Value, p), this->_Unit
|
||||
std::pow(this->_Value, p),
|
||||
this->_Unit.pow((short)p)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -180,7 +181,7 @@ Quantity& Quantity::operator +=(const Quantity &p)
|
||||
Quantity Quantity::operator -(const Quantity &p) const
|
||||
{
|
||||
if (this->_Unit != p._Unit)
|
||||
throw Base::UnitsMismatchError("Quantity::operator +(): Unit mismatch in minus operation");
|
||||
throw Base::UnitsMismatchError("Quantity::operator -(): Unit mismatch in minus operation");
|
||||
return Quantity(this->_Value - p._Value,this->_Unit);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user