# Thread: Value of Pie Problem

1. Thanks for the solution.
But what header file and what data type will make me print this to 1000 decimal places.
Code:
```#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
int n;
cout << setprecision (100) << (12*atan(1.0/49) + 32*atan(1.0/57) - 5*atan(1.0/239) + 12*atan(1.0/110443))*4;
cin >> n;
return 0;
}```

2. Option 1: As already mentioned, use an arbitrary precision math library.

Option 2: There are algorithms for calculating pi digit by digit. E.g one implementation found here (computes 800 digits, code unfortunately obfuscated to take less space):

Code:
```#include <cstdio>
int a=10000,b,c=2800,d,e,f[2801],g;

int main()
{
for(;b-c;)
f[b++]=a/5;
for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)
for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b);
}```

3. You might be interested in this: GNU MP Pi computation

The code's in C, but you could still learn from it. GMP is a good bignum lib, it has a C++, interface if you're interested.