math_fun_int.py 356 B

1234567891011121314
  1. # test the math functions that return ints
  2. try:
  3. import math
  4. except ImportError:
  5. print("SKIP")
  6. raise SystemExit
  7. for fun in (math.ceil, math.floor, math.trunc):
  8. for x in (-1.6, -0.2, 0, 0.6, 1.4, float('inf'), float('nan')):
  9. try:
  10. print(fun(x))
  11. except (ValueError, OverflowError) as e:
  12. print(type(e))