summaryrefslogtreecommitdiff
path: root/src/util/rational.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/rational.h')
-rw-r--r--src/util/rational.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/util/rational.h b/src/util/rational.h
index 5e187de7f..81e0f7fbd 100644
--- a/src/util/rational.h
+++ b/src/util/rational.h
@@ -203,10 +203,11 @@ public:
}
+
+
Rational operator+(const Rational& y) const{
return Rational( d_value + y.d_value );
}
-
Rational operator-(const Rational& y) const {
return Rational( d_value - y.d_value );
}
@@ -218,6 +219,16 @@ public:
return Rational( d_value / y.d_value );
}
+ Rational& operator+=(const Rational& y){
+ d_value += y.d_value;
+ return (*this);
+ }
+
+ Rational& operator*=(const Rational& y){
+ d_value *= y.d_value;
+ return (*this);
+ }
+
/** Returns a string representing the rational in the given base. */
std::string toString(int base = 10) const {
return d_value.get_str(base);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback