I’m using the GMP library to make a Pi program, that will calculate about 7 trillion digits of Pi. Problem is, I can’t figure out how many bits are needed to hold that many decimal places.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
7 trillion digits can represent any of 10^(7 trillion) distinct numbers.
x bits can represent 2^x distinct numbers.
So you want to solve:
Take the log-base-2 of both sides:
Recall that
log(a^b)=b * log(a):I get
23253496664212bits. I would add one or two more just to be safe. Good luck finding the petabytes to hold them, though.I suspect you are going to need a more interesting algorithm.