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

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -