$$ e^{\pi \sqrt{163}} \approx 262537412640768743.99999999999925 $$

E^(Pi Sqrt[163.0])
N[E^(Pi Sqrt[163.0]), 35]
NumberForm[E^(Pi Sqrt[163.]), 35]



That's not the 35 digits I expected. OTOH,

N[Pi* E, 35]

returns 35 digits,


but then

NumberForm[Pi*E*1., 35]

again doesn't:


So I'm confused. Why doesn't one N[] what the other one does? In the documentation:

NumberForm[ expr, n ]
prints with approximate real numbers in expr given to n-digit precision.

I read this three times, slowly, went for a cup of tea, and read it again. But 15 isn't 35, or is it?

  • 1
    $\begingroup$ It is, for sufficiently large values of... Okay, the issue, as stated in the response below, is that you cannot get more correct digits after the fact. To obtain 35 digits, use N[] on an exact input, not one that already contains approximate numbers of lower precision. $\endgroup$ Sep 14 '12 at 14:31
  • $\begingroup$ @Daniel - Thanks for the feedback. Are you referring to my 163.0 instead of 163? To be honest, I don't know why I wrote it that way :-/ $\endgroup$
    – stevenvh
    Sep 14 '12 at 14:35
  • 1
    $\begingroup$ Yes, I meant 163.0 was, in effect, polluting the input with machine precision. $\endgroup$ Sep 14 '12 at 14:36

The documentation states:

N does not raise the precision of approximate numbers in its input

163.0 (or 163., or 163`) is a machine precision number, and Mathematica will not fake a higher precision when a certain number of digits are requested with N.

See this answer and this tutorial for more.

These questions may also be of interest:

Converting to machine precision

Annoying display truncation of numerical results

  • $\begingroup$ @stevenvh In keeping with Mr.Wizard's advice, you may wish to compare using 163 (without the decimal point) in your code. $\endgroup$
    – DavidC
    Sep 14 '12 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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