<p>I'm trying to determine the asymptotic run-time of one of my algorithms, which uses exponents, but I'm not sure of how exponents are calculated programmatically.</p>

<p>I'm specifically looking for the pow() algorithm used for double-precision, floating point numbers.</p>

The usual approach, to raise a to the b, for an integer exponent, goes something like this:
```
```
result = 1
while b > 0
  if b is odd
    result *= a
    b -= 1
  b /= 2
  a = a * a
```
```
It is generally logarithmic in the size of the exponent.  The algorithm is based on the invariant "a^b*result = a0^b0", where a0 and b0 are the initial values of a and b.
For negative or non-integer exponents, logarithms and approximations and numerical analysis are needed.  The running time will depend on the algorithm used and what precision the library is tuned for.
Edit: Since there seems to be some interest, here's a version without the extra multiplication.
```
```
result = 1
while b > 0
  while b is even
    a = a * a
    b = b / 2
  result = result * a
  b = b - 1
```
```