Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/rational.py
diff options
context:
space:
mode:
Diffstat (limited to 'rational.py')
-rw-r--r--rational.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/rational.py b/rational.py
index 381b05a..34b298f 100644
--- a/rational.py
+++ b/rational.py
@@ -95,7 +95,7 @@ class Rational:
return ret
def __rsub__(self, lval):
- return self.__sub__(lval)
+ return -self.__sub__(lval)
def __mul__(self, rval):
if isinstance(rval, Rational):
@@ -124,7 +124,7 @@ class Rational:
return self.__div__(lval)
def __neg__(self):
- self.n = -self.n
+ return Rational(-self.n, self.d)
def __abs__(self):
self.n = abs(self.n)