I was performing some basic computations when I noticed that

NumberForm[N[Zeta[3]], {100, 100}]



This is having a very parasitic effect on my computations that are using $\zeta(3)$ and need high-precision values of constants. Is this really default behaviour in Mathematica? How can I make it return much more precise results?

  • 4
    $\begingroup$ The default precision is $MachinePrecision, which is typically 15.9..., corresponding to 53bit precision of 64bit floating point numbers. You can force higher precision using the second argument of N, e.g. NumberForm[N[Zeta[3], 100], {100, 100}] $\endgroup$
    – Lukas Lang
    Aug 15, 2019 at 12:15
  • 4
    $\begingroup$ With N, one can only lower the precision of numbers. (In Mathematica's ordering, machine precision is the lowest precision.) So N[1.,100] has no effect; it is SetPrecision[1.,100] that will convert to arbitrary precision. You can enter arbitrary-precision numbers also with a number after the backtick: Zeta[3.`100]. Also note that if finite-precision numbers appear in the computations, it is important to set the precision before the computations starts. In a general computation, numbers will be coerced to the lowest precision present. $\endgroup$ Aug 15, 2019 at 12:45
  • 2
    $\begingroup$ Single argument N[] means machine-precision, so the result is what was asked for. Also, NumberForm is purely for formatting, not computation. $\endgroup$
    – ilian
    Aug 15, 2019 at 14:41
  • $\begingroup$ Related: (501), (10624) $\endgroup$
    – Mr.Wizard
    Nov 14, 2019 at 12:54

2 Answers 2


To give a simple answer to the question in the title:

There is dedicated hardware in your CPU for machine precision computations. In contrast, arbitrary precision computations have to be emulated in software. That is why machine precision computations are orders of magnitude faster. And that is also why Mathematica uses machine precision as default. Most of the time, one can do really great with 16 digits.


How can I make it return much more precise results?

There is not a great discussion of precision and accuracy control, AFAIK.

Familiarize yourself with the functions in this guide:

Take care to distinguish distinct but related ones:

This tutorial goes some way toward an introduction to controlling precision:

  • Arbitrary-Precision Numbers

  • MachinePrecision numbers are treated as though they are of lower precision than arbitrary-precision numbers: if they are combined, the arbitrary-precision numbers are converted to machine precision. (Why? An arbitrary-precision number essentially consists of a point-estimate used for calculations and an error-bound estimate. No matter how low the precision, the internal point-estimate always has at least 16 digits stored. So there is no loss of accuracy in the conversion, only the loss of the error bound.)

Since all this is somewhat tangential to the question, I won't write a long exegesis (I don't have time, anyway). But ponder these precision tricks:

f[x_] := Sin[x]/x - 1;
wp = 60;
x0 = 1*^-30;     (* exact input *)
x1 = N[x0, wp];  (* approximate input with wp digits of precision *)

Block[{$MaxPrecision = wp, $MinPrecision = wp}, (* fixed working precision *)

0.*10^-60  <-- underflow/catastrophic subtractive cancellation

N[f[x0], wp] (* ATTEMPTS wp digits of precision & FAILS *)

> N::meprec: Internal precision limit $MaxExtraPrecision = 50.` reached while evaluating -1+1000000000000000000000000000000 Sin[1/1000000000000000000000000000000].


Block[{$MaxExtraPrecision = 100}, (* ATTEMPTS wp digits & SUCCEEDS *)
 N[f[x0], wp]]

Pay attention to the last two: N[f[x0], wp] is usually the most expensive and most accurate computation.

  • $\begingroup$ Hmm, "So there is no loss of accuracy in the conversion...": I don't think that says what I meant, but I'm having a brain-freeze... :/ $\endgroup$
    – Michael E2
    Aug 15, 2019 at 13:58

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