This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

$MachineEpsilon

$MachineEpsilon
gives the difference between and the next-nearest number representable as a machine-precision number.
  • $MachineEpsilon is typically , where n is the number of binary bits used in the internal representation of machine-precision floating-point numbers.
The result of adding 1 to $MachineEpsilon is distinct from 1:
Adding a fraction of $MachineEpsilon effectively results in rounding:
In[1]:=
Click for copyable input
Out[1]=
The result of adding 1 to $MachineEpsilon is distinct from 1:
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
Adding a fraction of $MachineEpsilon effectively results in rounding:
In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=
The result of subtracting from 1 is distinct from 1:
Find machine epsilon algorithmically:
Get the nearest machine number greater than another machine number:
and are distinct:
and differ only in the least significant bit:
Horner's method for evaluating a polynomial with a running error bound:
A polynomial with large coefficients:
Evaluate at x=10; the error is large, but within the bound:
$MachineEpsilon is a power of 2:
This is effectively where is the number of bits of machine precision:
1 and 1+$MachineEpsilon differ only in the least significant bit:
The resolution of machine numbers is twice as fine just below 1 versus just above 1:
New in 2