changeset 134:8e496d0ea446

Range analysis for rounded division
author Sigurd Meldgaard <stm@daimi.au.dk>
date Wed, 04 Nov 2009 10:53:23 +0100
parents 5252a8c52011
children 16f4be0b0e9a
files pysmcl/range_analysis.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/range_analysis.py	Mon Nov 02 12:02:08 2009 +0100
+++ b/pysmcl/range_analysis.py	Wed Nov 04 10:53:23 2009 +0100
@@ -182,6 +182,9 @@
         elif isinstance(node.op, ast.Mult):
             r0 = left[0] * right[0]
             r1 = left[1] * right[1]
+        elif isinstance(node.op, ast.FloorDiv):
+            r0 = left[0] // right[1]
+            r1 = left[1] // right[0]
         else:
             raise Exception("Operator not implemented: ", node.op)
         if(r0 > self.prime // 2 or r0 < -(self.prime // 2)