pycharm - Increase Accuracy of float division (python) -
i'm writing bit of code in pycharm, , want division more accurate (40-50 numbers instead of 15). how can accomplish this?
thanks.
check out decimal module:
>>> decimal import * >>> getcontext().prec = 50 >>> decimal(1)/decimal(7) decimal('0.14285714285714285714285714285714285714285714285714') if you're interested in more sophisticated operations decimal provides, can @ libraries bigfloat, or mpmath (which use, , lot.)
Comments
Post a Comment