0

I am approximating phi to 50 decimal places and want to return the value I have computed. I do not want to print it otherwise I can't use it in calculations. How can I do this because python only wants to display 11 decimal places or something like that? Thanks

1 Answers1

0

python floats do not have that precision. you need to use python decimal:

from decimal import getcontext, Decimal
getcontext().prec = 50
print(Decimal(1) / Decimal(7))

the drawback is that calculations with these will take much more time than the ones with float.

hiro protagonist
  • 44,693
  • 14
  • 86
  • 111