+ 1

Python compiling pi

I would like to calculate a designated amount of decimals, how can i store more digits of pi? https://code.sololearn.com/cTl17VzAax5x/?ref=app

7th Jan 2019, 4:01 AM
Imagine Existance
Imagine Existance - avatar
3 Respostas
+ 3
You can use f-strings for that. For example (line 6): print(f"{pia:.16f}") # prints 16 digits after decimal point print(f"{pia:.20f}") # prints 20 digits after decimal point
7th Jan 2019, 6:32 AM
Diego
Diego - avatar
0
The Python standard library has a decimal module for arbitrary precision arithmetic. The documentation of that module has an example of a pi calculator using the module so you can build on that.
22nd Apr 2021, 10:56 PM
Sheikh
Sheikh - avatar