EDIT 1: Here are links to the actual source http://opensource.apple.com/source/Libm/Libm-2026/Source/Intel/expf_logf_powf.c http://opensource.apple.com/source/Libm/Libm-315/Source/ARM/powf.c I got the links from this question, which has a bunch of relevant discussion https://stackoverflow.com/questions/9652549/self-made-pow-c This page describes an algorithm: [Link](https://web.archive.org/web/20180128170435/http://mathforum.org/library/drmath/view/55896.html). x^(1/n) = the nth root of x, and x^mn = (x^m)^n. Thus, x^(m/n) = (the nth root of x)^m. Arbitrary roots can be calculated with Newton's method. Integer powers can be calculated with Exponentiation by squaring. For irrational exponents, you can use increasingly accurate rational approximations until you get the desired number of significant digits. EDIT 2: Newton's method involves raising your current guess to the power of the root that you're trying to find. If that power is large, and the guess is even a little too high, this can result in overflow. One solution here is to identify this case. If overflow ever occurs, this means that the guess was too high. You can solve the problem by (whenever a guess results in overflow), setting the current guess to a value between the last guess that did not overflow and the current guess (you may have to do this several times). That is, whenever Newton's method overflows, do a binary search down toward the last guess that did not overflow. Here's some python that implements all of this: def nroot(n, b, sig_figs = 10): g1 = 1.0 g2 = 1.0 while True: done = False while not done: try: g3 = g2 - ((g2**b) - n) / (b * (g2**(b-1))) done = True except OverflowError: g2 = (g1 + g2) / 2.0 if abs(g2 - g3) < 1.0 / (10**sig_figs): return g3 g1 = g2 g2 = g3 def npowbysqr(n, p): if p == 0: return 1.0 if p % 2 == 0: v = npowbysqr(n, p/2) return v*v else: return n*npowbysqr(n, p-1) def npow(n, p): return npowbysqr(nroot(n, 1000000), int(p*1000000)) print npow(5, 4.3467) print 5**4.3467 I should add that there are probably much better solutions. This does seem to work, however