gives the numerical value of expr.


attempts to give a result with ndigit precision.


  • Unless numbers in expr are exact, or of sufficiently high precision, N[expr,n] may not be able to give results with ndigit precision.
  • N[expr,n] may internally do computations to more than n digits of precision.
  • $MaxExtraPrecision specifies the maximum number of extra digits of precision that will ever be used internally.
  • The precision n is given in decimal digits; it need not be an integer.
  • n must lie between $MinPrecision and $MaxPrecision. $MaxPrecision can be set to Infinity.
  • n can be smaller than $MachinePrecision.
  • N[expr] gives a machineprecision number, so long as its magnitude is between $MinMachineNumber and $MaxMachineNumber.
  • N[expr] is equivalent to N[expr,MachinePrecision].
  • N[0] gives the number 0. with machine precision.
  • N converts all nonzero numbers to Real or Complex form.
  • N converts each successive argument of any function it encounters to numerical form, unless the head of the function has an attribute such as NHoldAll.
  • You can define numerical values of functions using N[f[args]]:=value and N[f[args],n]:=value.
  • N[expr,{p,a}] attempts to generate a result with precision at most p and accuracy at most a.
  • N[expr,{Infinity,a}] attempts to generate a result with accuracy a.
  • N[expr,{Infinity,1}] attempts to find a numerical approximation to the integer part of expr.


open allclose all

Basic Examples  (3)

Evaluate numerically:

Click for copyable input

Evaluate numerically to 50-digit precision:

Click for copyable input

With machine-precision input, the results are always machine precision:

Click for copyable input

With exact input, the results can be to the precision specified:

Click for copyable input

Scope  (20)

Generalizations & Extensions  (3)

Properties & Relations  (3)

Neat Examples  (1)

See Also

Chop  CompiledFunction  Rationalize  MachinePrecision  NHoldAll  RealDigits  PossibleZeroQ


Introduced in 1988
| Updated in 2003