d02 ex02 errors comparisons and _value
This commit is contained in:
@@ -113,13 +113,13 @@ bool Fixed::operator> (Fixed const & rhs) const {
|
||||
return rhs < *this;
|
||||
}
|
||||
bool Fixed::operator<=(Fixed const & rhs) const {
|
||||
return !(rhs > *this);
|
||||
return !(*this > rhs);
|
||||
}
|
||||
bool Fixed::operator>=(Fixed const & rhs) const {
|
||||
return !(rhs < *this);
|
||||
return !(*this < rhs);
|
||||
}
|
||||
bool Fixed::operator==(Fixed const & rhs) const {
|
||||
return this->toFloat() == rhs.toFloat();
|
||||
return this->_value == rhs._value;
|
||||
}
|
||||
bool Fixed::operator!=(Fixed const & rhs) const {
|
||||
return !(*this == rhs);
|
||||
@@ -141,8 +141,8 @@ Fixed Fixed::operator* ( Fixed const & rhs ) const {
|
||||
}
|
||||
Fixed Fixed::operator/ ( Fixed const & rhs ) const {
|
||||
Fixed result(*this);
|
||||
if (rhs.value == 0)
|
||||
std::cout << "impossible division by 0\n";
|
||||
if (rhs._value == 0)
|
||||
std::cout << "!impossible division by 0¡";
|
||||
else
|
||||
result._value = (long)(result._value << Fixed::_frac) / rhs._value;
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user