cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
integer exponentiation
integer exponentiation
Nov 26, 2011 at 12:12am UTC
mzimmers
(578)
How do you handle it -- roll your own function, or use something off-the-shelf?
Nov 26, 2011 at 12:24am UTC
kbw
(9488)
Role your own I suppose. Integers aren't too tricky to handle.
Nov 26, 2011 at 12:48am UTC
mzimmers
(578)
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 UTC
Duthomhas
(13282)
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.