integer exponentiation

Nov 26, 2011 at 12:12am
How do you handle it -- roll your own function, or use something off-the-shelf?
Nov 26, 2011 at 12:24am
Role your own I suppose. Integers aren't too tricky to handle.
Nov 26, 2011 at 12:48am
Yeah, I suppose you're right...it just still amazes me that C++ doesn't provide a function for this.
Nov 26, 2011 at 1:02am
Why should it? You rarely need to work with integer types for this kind of math.

That said, there are simple methods for it:
http://eli.thegreenplace.net/2009/03/21/efficient-integer-exponentiation-algorithms/

Hope this helps.
Topic archived. No new replies allowed.