Skip to content
Snippets Groups Projects
Commit bacb52aa authored by Damien George's avatar Damien George
Browse files

tests/float: Add tests for math funcs that return ints.

One should test bigint, inf and nan to make sure all cases are covered.
parent c073519e
No related branches found
No related tags found
No related merge requests found
# test the math functions that return ints
try:
import math
except ImportError:
print("SKIP")
import sys
sys.exit()
for fun in (math.ceil, math.floor, math.trunc):
for x in (-1.6, -0.2, 0, 0.6, 1.4, float('inf'), float('nan')):
try:
print(fun(x))
except (ValueError, OverflowError) as e:
print(type(e))
# test the math functions that return ints, with very large results
try:
import math
except ImportError:
print("SKIP")
import sys
sys.exit()
for fun in (math.ceil, math.floor, math.trunc):
for x in (-1e25, 1e25):
print('%.3g' % fun(x))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment