Are there any variable types that can hold infinite digits?

I'm trying to write a program that can find like the first million digits of pi, and I'm having some trouble finding a variable that can hold that many digits. Im still pretty new with c++ so yeah....

Thank You in advance! :D


Edit:

I already tried int(derr lol) and floats, but floats only hold 5 digits T_T
Last edited on
You have to use a bigmath library. Look up GMP, for example.
jsmith is right, but I was trying to come up with another solution. Assuming 22/7 was actually a good representation of PI and you were happy with 9999999 digits of precision this would work:
BTW, you may want to use sleep or something so you can actually see the results.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<iostream>
using namespace std;
int main(){
    int x[99999];cout<<"here";
    int dividend=22;
    int divisor=7;
    int remainder=1;
    int count=0;
    while(remainder!=0&&count<9999999)
    {
                              
                              x[count]=dividend/divisor;
                              remainder=dividend%divisor;
                              remainder=remainder*10;
                              dividend=remainder;                              
                              cout<<x[count];
                              if(count==0) cout<<".";
                              ++count;
                              
    }
    return 0;
}
Topic archived. No new replies allowed.