Base: improve base python object number protocol

This commit is contained in:
Zheng, Lei
2019-08-25 16:16:18 +08:00
committed by wmayer
parent daf96d29fd
commit 1efadc928e
6 changed files with 233 additions and 123 deletions

View File

@@ -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);
}