Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When i click Approximate Form in result, the result is:


but when i click More Digit:


Why the number is different? (instead of showing more digit) and what is the actual solution?

share|cite|improve this question
When strange things happen with floating point, there is always a good reading: – Jean-Claude Arbaut Mar 15 '13 at 11:22

The first one is evaluated using WolframAlpha's exponential function. Now I'm not sure how $\exp$ is implemented in WA, but in Java, for instance, if $r$ is small, $\exp(r)$ will be approximated as: \begin{align*} \exp(r) &= 1+r+\frac{rR_1}{2-R_1},\\ R_1 &= r-\left(\frac{r^2}6 + P_2\,r^4 + P_3\,r^6 + P_4\,r^8 + P_5\,r^{10}\right) \end{align*} where $|P_2|,\ldots,|P_5|\ll1$. So, if $r=10^{-15}$ and double-precision floating point arithmetic is used, $\frac{rR_1}{2-R_1}$ will be dropped and hence $\exp(r)$ will be equal to the result of storing $1+r$ in double precision, i.e. $1+2^{-50}+2^{-52}\approx1+1.11022\times10^{-15}$. Hence $\dfrac{e^r-1}{r}=\dfrac{2^{-50}+2^{-52}}{10^{-15}}\approx1.11022$. (Matlab also gives the same number.) This explains the first result. I have no idea how the second result was calculated.

share|cite|improve this answer

I am not totally sure but i guess this is a problem of the double floating point precision. If you only calculate with a precision of $10^{-16}$ (so called machine precision) you always get errors in the result. If you chose more digits it will calculate with a higher precision and the final result will be nearer at the exact solution.

share|cite|improve this answer

The approximations are incorrect and artifact of the rounding and precision errors. Better start with the expansion of $e^x = 1 + x + \frac{x^2}2 + \frac{x^3}{3!} \dots$ Your function $\frac{e^x-1}x = 1 + \frac{x}2 + \frac{x^2}{3!}+\dots$ Substitute x and truncate the series based on your desired precision.

ps. In WolframAlpha if you substitute $x=10^{-14}$ you'll get a result less than $1$, which is nonsense.

share|cite|improve this answer

You are seeing exactly the exponential expansion in both cases, limited to the available precision, which is computed with a 64 bit double in the default case and a hundred digits in the "More Digits" case.

Let's try it by hand: $$e^x \approx 1 + x + {x^2 \over 2!} + {x^3 \over 3!} + \dots$$

With a double: $1 + 10^{-15} + 10^{-30}/2 + \dots$ and we have 53 bits $\approx$ 17.46 decimal digits of accuracy, so we can drop the $x^2$ and higher terms.

Now, what is $1+10^{-15}$ in 64 bit floating point representation? Well, it certainly can't represent it exactly. Rather, we have a 53 bit binary number which tries to get as close as possible. Note that $2^{-50}$ + $2^{-52}$ = $1.110223\dots \cdot 10^{-15}$, so that's the best we can do.

Subtract off $1$ and you're left with this as an error term.

The hundred-digit one is correct. You can see the $10^{-15}$ term, the half-$10^{-30}$ term (5 and then a bunch of zeros), the cubic term--it's $1 over 6$ so you get 16666 in the decimal expansion, and then the quartic term comes in on top of it $6666666... + 0416666... \rightarrow 70833333$ etc..

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.