Skip to content
This repository has been archived by the owner on Sep 10, 2019. It is now read-only.

Commit

Permalink
Change BigInteger divisor operation to use floordiv rather than truediv
Browse files Browse the repository at this point in the history
  • Loading branch information
localhuman committed Aug 23, 2018
1 parent f2ef604 commit b537fc8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion HISTORY.rst
Expand Up @@ -4,7 +4,7 @@ History

0.5.1-dev (in progress)
-----------------------
* ...
* Change BigInteger divisor operation to use floordiv rather than truediv


0.5.0 (2018-08-21)
Expand Down
2 changes: 1 addition & 1 deletion neocore/BigInteger.py
Expand Up @@ -51,7 +51,7 @@ def __floordiv__(self, *args, **kwargs):
return BigInteger(super(BigInteger, self).__floordiv__(*args, **kwargs))

def __truediv__(self, *args, **kwargs): # real signature unknown
return BigInteger(super(BigInteger, self).__truediv__(*args, **kwargs))
return BigInteger(super(BigInteger, self).__floordiv__(*args, **kwargs))


ZERO = BigInteger(0)
Expand Down
10 changes: 10 additions & 0 deletions tests/test_numbers.py
Expand Up @@ -229,6 +229,16 @@ def test_big_integer_div(self):
self.assertIsInstance(b3, BigInteger)
self.assertEqual(b3, 1000000)

def test_big_integer_div2(self):
b1 = BigInteger(41483775933600000000)
b2 = BigInteger(414937759336)

b3 = b1 / b2
b4 = b1 // b2
self.assertIsInstance(b3, BigInteger)
self.assertEqual(b3, 99975899)
self.assertEqual(b4, b3)

def test_big_integer_float(self):
b1 = BigInteger(5505.001)
b2 = BigInteger(55055.999)
Expand Down

0 comments on commit b537fc8

Please sign in to comment.