i want to elevate a number to a big exponent, why isn't this working?
ttmath::UInt<1> p,b;
p = "210";
ttmath::UInt<7500> n;
b = "2";
n = (b.Pow(p))-1;
cout << n;
This isn't working i want 'b' to be elevated to 'p' and subtracted 1 and then printed.
If p = smaller numbers like 21 it works fine, when i start increasing for example to 210 it doesn't work.
I want to elevate 2 to 216091 but in the future i will probably need to elevate it to around 90000000.
P.S. i checked and 'n' seems like big enough to hold (2^216091)-1 so it should work with 210.
n = (b.Pow(p))-1;
b.Pow() doesn't return a value, its return a carry (zero or one)
try this:
ttmath::UInt<1> p;
ttmath::UInt<10> b, n;
p = "210";
b = "2";
int carry = b.Pow(p);
n = b;
n -=1;
if( carry )
cout << "ops, b was to small" << endl;
else
cout << n << endl;