To Find Large Powers in

Hi guys,
I have two numbers A and B where both can be in the range 0-100000.

How can we find the value of A^B without using non standard libraries as GMP or BOOST? It should be running on embedded MCU.
what is the actual c++ type of A and B?

does the pow() function work?

you can do it with logs as well. If you don't need the actual value (if these are intermediate computations but not the end goal for example) logs can prevent having to deal with the huge values...

But pow and log need a type that c++ understands. If these are weird big-integer or oversized floating point, it won't work.

do you allow fractional powers like pi ^ pi?

These powers are so large that you may want to keep the numbers in a split format of base and exponent, sort of like a fraction class that maintains num/denom separate?
Last edited on
Topic archived. No new replies allowed.