Sign up ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm working on a multiple-precision library. I'd like to make it possible for users to ask for higher precision answers for results already computed at a fixed precision. My $\mathrm{sqrt}(x)$ can pick up where it left off, even if $x$ changes a bit, because it uses Newton-Raphson. But $\exp(x)$ computed using a Maclaurin series or continued fraction has to be computed from scratch.

Is there an iterative refinement (i.e. Newton-Raphson, gradient descent) method for computing $\exp(x)$ that uses only arithmetic and integer roots?

(I know Newton-Raphson can solve $\log(y)-x=0$ to compute $\exp(x)$. I am specifically not asking for that. Newton-Raphson can also solve $\exp(y)-x=0$ to compute $\log(x)$. Note that each requires the other. I have neither right now as an arbitrary-precision function. I have arithmetic, integer roots, and equality/inequality tests.)

share|cite|improve this question
I don't believe there's a refinement scheme for $\exp(z)$. The best I've seen, assuming you're using scaling+squaring, is to have to redo series/CF computations on a version of $z\cdot2^{-n}$ with greater precision, and then square $n$ times. –  Guess who it is. Sep 25 '10 at 6:01
Not sure if it helps, I know there is an algorithm to compute kth digit of pi (in base 16). Perhaps something like that exists for exp(x) in base 10/whatever base you are working in. Spigot algorithm is the name I believe. (not sure) –  Aryabhata Sep 25 '10 at 13:41
There is a spigot algorithm for $e$, but I don't see how it generalizes to $\exp(x)$. –  Guess who it is. Sep 25 '10 at 23:32
@J.M., it generalises to convergent hypergeometrics. See… for code –  Peter Taylor Jan 21 '11 at 18:18

1 Answer 1

There is an algorithm for computing $\log_2(x)$ that might suit you. Combine that with the spigot algorithm for $e$, and you can get $\ln(x)$. From there, you can use Newton-Raphson to get $\exp(x)$.

I don't know if this roundabout way ends up doing any better than just recomputing.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.