2017-03-23 08:54:10 -04:00
|
|
|
# test the math functions that return ints
|
|
|
|
|
|
|
|
try:
|
|
|
|
import math
|
|
|
|
except ImportError:
|
|
|
|
print("SKIP")
|
2017-06-08 00:00:57 -04:00
|
|
|
raise SystemExit
|
2017-03-23 08:54:10 -04:00
|
|
|
|
|
|
|
for fun in (math.ceil, math.floor, math.trunc):
|
2020-03-22 22:26:08 -04:00
|
|
|
for x in (-1.6, -0.2, 0, 0.6, 1.4, float("inf"), float("nan")):
|
2017-03-23 08:54:10 -04:00
|
|
|
try:
|
|
|
|
print(fun(x))
|
|
|
|
except (ValueError, OverflowError) as e:
|
|
|
|
print(type(e))
|