We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9382a42 commit 91dc079Copy full SHA for 91dc079
src/flint/test/test_all.py
@@ -207,6 +207,13 @@ def test_fmpz():
207
assert math.ceil(f) == 2
208
assert type(math.ceil(f)) is flint.fmpz
209
210
+ # Float conversion should follow Python rounding conventions
211
+ for mant in range(2**56 - 64, 2**56 + 64):
212
+ for shift in range(0, 900, 20):
213
+ for eps in range(-5, 5):
214
+ f = (mant << shift) + eps
215
+ assert float(f) == float(flint.fmpz(f))
216
+ assert float(-f) == float(flint.fmpz(-f))
217
# Test float conversion overflow
218
assert raises(lambda: float(flint.fmpz(2**1024)), OverflowError)
219
assert raises(lambda: float(flint.fmpz(-2**1024)), OverflowError)
0 commit comments