"Nicholas Paldino [.NET/C# MVP]" wrote:

If you want to use integral values, you could always write the algorithm

yourself (looping through n times, multiplying the result by itself).

Hope this helps.

that's horridly inefficient with large exponents though. There's a much

better way to do integer exponents using shifting. Treat the exponent as a

string of bits. Then for each bit that has a value of 1, add the base

shifted left by the bit number. Ie N^13 (13 = 1101) = N + N shifted left 2

bits + N shifted left 3 bits. It doesn't matter much with small exponenets

but with big ones 32 shifts/adds pairs is far faster than millions of

multiplications.