Created
January 24, 2014 14:05
-
-
Save ami-GS/8597886 to your computer and use it in GitHub Desktop.
高精度の10進数演算と小数点以下の長さ決定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from decimal import * | |
getcontext().prec = 1000000#表示したい桁 デフォルトは28 | |
N = 100 | |
print (Decimal(1) + Decimal(1) / Decimal(N)) ** Decimal(N) | |
# or more precisely | |
print Decimal(1).exp() | |
#the length of above calculation is 101 (which include ".") | |
#to get numerical value, you shoulde type str(Decimal(1).exp()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment