Skip to content

Commit

Permalink
Fix an integer division issue with MagnitudeIntBuilder
Browse files Browse the repository at this point in the history
Fixes #25.

Python 2.7.x and Python 3.x handle integer division differently.
The former returns the integer part if two integers are divided,
while the latter always returns a float.
  • Loading branch information
drmfinlay committed Nov 12, 2018
1 parent 2c11cec commit 6d78fdd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dragonfly/language/base/integer_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def build_element(self, min, max):
if min >= max: return None

# Calculate ranges of multipliers and remainders.
first_multiplier = min / self._factor
last_multiplier = (max - 1) / self._factor + 1
first_multiplier = int(min / self._factor)
last_multiplier = int((max - 1) / self._factor + 1)
first_remainder = min % self._factor
last_remainder = max % self._factor
if last_remainder == 0:
Expand Down

0 comments on commit 6d78fdd

Please sign in to comment.