int_big_float.py 553 B

12345678910111213141516171819202122232425262728
  1. # test bignum operation with float/complex
  2. i = 1 << 65
  3. # convert bignum to float on rhs
  4. print("%.5g" % (2.0 * i))
  5. # negative bignum as float
  6. print("%.5g" % float(-i))
  7. # this should convert to float
  8. print("%.5g" % (i / 5))
  9. # these should delegate to float
  10. print("%.5g" % (i * 1.2))
  11. print("%.5g" % (i / 1.2))
  12. # this should delegate to complex
  13. print("%.5g" % (i * 1.2j).imag)
  14. # negative power should produce float
  15. print("%.5g" % (i ** -1))
  16. print("%.5g" % ((2 + i - i) ** -3))
  17. try:
  18. i / 0
  19. except ZeroDivisionError:
  20. print("ZeroDivisionError")