Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Martin <gary@garycmartin.com>2012-03-20 14:51:18 (GMT)
committer Gary Martin <gary@garycmartin.com>2012-03-20 14:51:18 (GMT)
commita2cbde202c7450b12b118b688d8399a6c836ca10 (patch)
tree60348330c285ce9c75d783c762ab4ad27433bde5
parent2690934c0fc7c20b72884307e3759ec71ec1fdc8 (diff)
Trivial divide calculations can generate results with rounding errors #SL2332 (Miguel Garcia).
-rw-r--r--mathlib.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mathlib.py b/mathlib.py
index d0fabc8..746df48 100644
--- a/mathlib.py
+++ b/mathlib.py
@@ -221,7 +221,7 @@ class MathLib:
elif type(n) is types.LongType:
n = self.d(n)
elif isinstance(n, Rational):
- n = self.d(float(n))
+ n = self.d(Decimal(n.n) / Decimal(n.d))
elif not isinstance(n, Decimal):
return _('Error: unsupported type')