({{, (RefLink[MachinePrecision, paclet:ref/MachinePrecision]) 
is a symbol used to indicate machine-number precision. }})

OpenersNotesSection(Spacer1)Details

The numerical value of (RefLink[MachinePrecision, paclet:ref/MachinePrecision]) is (RefLink[$MachinePrecision, paclet:ref/$MachinePrecision]).

(RefLink[Precision, paclet:ref/Precision])[1.] gives (RefLink[MachinePrecision, paclet:ref/MachinePrecision]).

(RefLink[MachinePrecision, paclet:ref/MachinePrecision]) is the default specification for precision in (RefLink[N, paclet:ref/N]) and other numerical functions.

Approximate real numbers are assumed to have precision specified by (RefLink[MachinePrecision, paclet:ref/MachinePrecision]) if fewer than (RefLink[$MachinePrecision, paclet:ref/$MachinePrecision]) explicit digits are entered.

The option setting (RefLink[WorkingPrecision, paclet:ref/WorkingPrecision])->MachinePrecision specifies that internal computations in numerical functions should be done with machine numbers.

(RefLink[MachinePrecision, paclet:ref/MachinePrecision]) is treated as a numeric constant, with attribute (RefLink[Constant, paclet:ref/Constant]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (13)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Precision[5.6]

N[%]

(RefLink[MachinePrecision, paclet:ref/MachinePrecision]) is treated as an exact numeric quantity:

NumericQ[MachinePrecision]&&Not[InexactNumberQ[MachinePrecision]]

Use it like any number:

Round[MachinePrecision]

N[MachinePrecision,50]

The number of bits represented:

Log[2.,10]MachinePrecision

OpenersExampleSection1(Spacer1)Scope  (2)

The machine number approximating e:

N[E,MachinePrecision]

An arbitrary-precision number approximating e to the same precision as machine numbers:

N[E,$MachinePrecision]

Use machine-number arithmetic to solve a differential equation:

ode={x''[t]+Sin[x[t]]==Cos[t],x[0]==x'[0]==0};

msol=NDSolve[ode,x,{t,0,100},WorkingPrecision->MachinePrecision]

Use double machine precision:

bsol=NDSolve[ode,x,{t,0,100},WorkingPrecision->2 MachinePrecision]

Compare the two solutions:

Plot[Evaluate[x[t]/.{msol,bsol}],{t,0,100}]

OpenersExampleSection2(Spacer1)Applications  (3)

Evaluate to double machine precision:

N[Pi,2MachinePrecision]

Use machine precision for the default precision argument in a function definition:

cuberoot[x_,prec_:MachinePrecision]:=s/.FindRoot[s^3-x,{s,1.},WorkingPrecision->prec]

cuberoot[2]

cuberoot[2,50]

Make sure computations are carried out with the same precision as machine numbers:

Block[{$MinPrecision=MachinePrecision,$MaxPrecision=MachinePrecision},Exp[1000.]-(Exp[1000.1]-Exp[999.9])/(1000.1-999.9)]

Without fixing the precision, the resulting precision may be lower:

Exp[1000.]-(Exp[1000.1]-Exp[999.9])/(1000.1-999.9)

OpenersExampleSection3(Spacer1)Properties & Relations  (4)

Numbers with just a few digits entered are assumed to have machine precision:

x=1.23456789

Precision is based on the number of digits when more than (RefLink[$MachinePrecision, paclet:ref/$MachinePrecision])+1 are entered:

y=1.234567890123456789

{Precision[x],Precision[y]}

(RefLink[MachinePrecision, paclet:ref/MachinePrecision]) is a numerical constant while (RefLink[$MachinePrecision, paclet:ref/$MachinePrecision]) evaluates to a number:

{$MachinePrecision,MachinePrecision}

(RefLink[MachinePrecision, paclet:ref/MachinePrecision]) is numerically (RefLink[Equal, paclet:ref/Equal]) to (RefLink[$MachinePrecision, paclet:ref/$MachinePrecision]):

MachinePrecision==$MachinePrecision

(RefLink[$MachinePrecision, paclet:ref/$MachinePrecision]) is the machine-precision approximation to (RefLink[MachinePrecision, paclet:ref/MachinePrecision]):

N[{$MachinePrecision,MachinePrecision}]

N[{$MachinePrecision,MachinePrecision},30]

(RefLink[MachinePrecision, paclet:ref/MachinePrecision]) times the number of bits per digit gives the binary machine precision:

MachinePrecision*Log[2.,10.]

Digits beyond the known precision are represented as (RefLink[Indeterminate, paclet:ref/Indeterminate]):

RealDigits[22/7.,10,Round[MachinePrecision+3]]

OpenersExampleSection4(Spacer1)Possible Issues  (2)

Subnormal machine numbers have precision (RefLink[MachinePrecision, paclet:ref/MachinePrecision]):

x=$MinMachineNumber/2

Precision[x]

However, they effectively have less precision and have the same uncertainty as (RefLink[$MinMachineNumber, paclet:ref/$MinMachineNumber]):

Accuracy[x]==Accuracy[$MinMachineNumber]

Subnormal machine numbers entered in (RefLink[InputForm, paclet:ref/InputForm]) will drop non-representable digits:

5.1234*^-324//InputForm

Enter as an arbitrary-precision number to keep all the digits:

5.1234`5*^-324//InputForm

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[$MachinePrecision, paclet:ref/$MachinePrecision])  ▪  (RefLink[MachineNumberQ, paclet:ref/MachineNumberQ])  ▪  (RefLink[Precision, paclet:ref/Precision])  ▪  (RefLink[Accuracy, paclet:ref/Accuracy])  ▪  (RefLink[N, paclet:ref/N])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Numerical Precision, paclet:tutorial/NumericalPrecision])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Precision & Accuracy Control, paclet:guide/PrecisionAndAccuracyControl])}})}})