aboutsummaryrefslogtreecommitdiff
path: root/common/rational.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/rational.cpp')
-rw-r--r--common/rational.cpp26
1 files changed, 1 insertions, 25 deletions
diff --git a/common/rational.cpp b/common/rational.cpp
index e27e880a04..91d1c5a848 100644
--- a/common/rational.cpp
+++ b/common/rational.cpp
@@ -49,7 +49,7 @@ Rational::Rational(int num, int denom) {
void Rational::cancel() {
// Cancel the fraction by dividing both the num and the denom
- // by their greatest common denom.
+ // by their greatest common divisor.
int gcd = Common::gcd(_num, _denom);
@@ -144,65 +144,49 @@ const Rational Rational::operator-() const {
const Rational Rational::operator+(const Rational &right) const {
Rational tmp = *this;
-
tmp += right;
-
return tmp;
}
const Rational Rational::operator-(const Rational &right) const {
Rational tmp = *this;
-
tmp -= right;
-
return tmp;
}
const Rational Rational::operator*(const Rational &right) const {
Rational tmp = *this;
-
tmp *= right;
-
return tmp;
}
const Rational Rational::operator/(const Rational &right) const {
Rational tmp = *this;
-
tmp /= right;
-
return tmp;
}
const Rational Rational::operator+(int right) const {
Rational tmp = *this;
-
tmp += right;
-
return tmp;
}
const Rational Rational::operator-(int right) const {
Rational tmp = *this;
-
tmp -= right;
-
return tmp;
}
const Rational Rational::operator*(int right) const {
Rational tmp = *this;
-
tmp *= right;
-
return tmp;
}
const Rational Rational::operator/(int right) const {
Rational tmp = *this;
-
tmp /= right;
-
return tmp;
}
@@ -296,33 +280,25 @@ Rational::operator double() const {
const Rational operator+(int left, const Rational &right) {
Rational tmp = right;
-
tmp += left;
-
return tmp;
}
const Rational operator-(int left, const Rational &right) {
Rational tmp = right;
-
tmp -= left;
-
return tmp;
}
const Rational operator*(int left, const Rational &right) {
Rational tmp = right;
-
tmp *= left;
-
return tmp;
}
const Rational operator/(int left, const Rational &right) {
Rational tmp = right;
-
tmp /= left;
-
return tmp;
}