What is the maximum number of decimal digits that python can work with? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the maximum number of decimal digits that python can work with?

I am talking about the size of y in decimal number x.y (0<=x<=9). How many digits can y comprise of (max limit)?

25th Jan 2022, 9:00 AM
Avinash Suresh
1 Answer
+ 1
Python itself does not have a limit to decimal places for the type decimal, it is depend upon the power of the machine that's running the code (since it requires lots of memory for large amounts of decimal places). How it works is, type decimal has a default 28 decimal place precision. You can change it to the precision you want. It can be a very large number up to decimal.MAX_PREC. See the following for more details https://stackoverflow.com/questions/53660036/how-to-get-largest-possible-precision-python-decimal https://zetcode.com/python/decimal/#:~:text=Python%20decimal,-The%20Python%20decimal&text=It%20is%20appropriate%20for%20financial,default%20precision%20is%2028%20places.
25th Jan 2022, 9:23 AM
Sandy Ho
Sandy Ho - avatar