fork download
  1. import decimal
  2. #確認はこれで出来る
  3. print(decimal.MAX_EMAX)
  4.  
  5. with decimal.localcontext() as ctx:
  6. print(ctx.Emax)
  7. ctx.Emax = decimal.MAX_EMAX
  8. print(ctx.Emax) #
  9. #これを超えて設定しようとするとエラーになる
  10. ctx.Emax = decimal.MAX_EMAX + 1
  11. print(ctx.Emax)
Runtime error #stdin #stdout #stderr 0.18s 23684KB
stdin
Standard input is empty
stdout
999999999999999999
999999
999999999999999999
stderr
Traceback (most recent call last):
  File "./prog.py", line 10, in <module>
    ctx.Emax = decimal.MAX_EMAX + 1
ValueError: valid range for Emax is [0, MAX_EMAX]