float_parse_doubleprec.py 755 B

123456789101112131415161718192021
  1. # test parsing of floats, requiring double-precision
  2. # very large integer part with a very negative exponent should cancel out
  3. print(float('9' * 400 + 'e-100'))
  4. print(float('9' * 400 + 'e-200'))
  5. print(float('9' * 400 + 'e-400'))
  6. # many fractional digits
  7. print(float('.' + '9' * 400))
  8. print(float('.' + '9' * 400 + 'e100'))
  9. print(float('.' + '9' * 400 + 'e-100'))
  10. # tiny fraction with large exponent
  11. print('%.14e' % float('.' + '0' * 400 + '9e100'))
  12. print('%.14e' % float('.' + '0' * 400 + '9e200'))
  13. print('%.14e' % float('.' + '0' * 400 + '9e400'))
  14. # ensure that accuracy is retained when value is close to a subnormal
  15. print(float('1.00000000000000000000e-307'))
  16. print(float('10.0000000000000000000e-308'))
  17. print(float('100.000000000000000000e-309'))