How to raise a number to a power?
Hi Tomek,
Can you tell me how I raise one number to another, please?
For example, if I write
ttmath::Big <1,4> answer(0.0), four(4.0), two(2.0);
answer = four.Exp(two);
Will only give me 0,1 or 2, but
answer = Exp(four, two);
Gives me an error telling that there are too many arguments.
answer.Exp(four, two) gives me a similar error.
I also get the same results with pow.
So i'm stumped. Is the only way to do this using loops?
Thanks again, James
Ok, I figured it out.
If i write
ttmath::Int<4> four(4), two(2);
four.Pow(two);
Then the answer is put in four so four now changes into 16.
If i write
Answer = four.Pow(two);
Then i only get a variable 0 , 1 or 2 depending on the condition.
^^^ 0, 1 or 2 is put into Answer.