fork download
  1. #(max_emax)
  2. from decimal import *
  3. getcontext().prec = 100
  4. from decimal import localcontext
  5. with localcontext() as ctx:
  6. print(ctx.Emax) # デフォルトの指数上限は999999なので、今回の計算だと足りない
  7. ctx.Emax = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 # 指数上限を増やす
  8. s = ctx.power(10,99)
  9. print(s)
  10. t = (10 ** s)
  11. print(t)
  12. #必要に応じて有効桁を調整する
  13. format_str = "{:.1e}".format(t)
  14. print(format_str)
  15.  
Success #stdin #stdout 0.05s 66200KB
stdin
Standard input is empty
stdout
999999999
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1.0e+1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000