Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinier Heeres <rwh@rwh.(none)>2008-09-18 19:25:20 (GMT)
committer Reinier Heeres <rwh@rwh.(none)>2008-09-18 19:25:20 (GMT)
commit01f1b6315bc061f846dc4ce1a56168bc9ed524e8 (patch)
tree9ccecfc54c4242d9d691193a93ece1a925f09160
parentd924166039df65e4affa5120a6aa5cab2542fe50 (diff)
Return "undefined" for division by zero
-rw-r--r--eqnparser.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/eqnparser.py b/eqnparser.py
index 4b6c82e..a0cde8f 100644
--- a/eqnparser.py
+++ b/eqnparser.py
@@ -665,6 +665,8 @@ class EqnParser:
return ret
def div_operator(self, a, b):
+ if b == 0 or b == 0.0:
+ return _('Undefined')
if isinstance(a, Rational) or isinstance(b, Rational):
return a / b
elif self.ml.is_int(a) and float(self.ml.abs(a)) < 1e12 and \