gives the difference between 1.0 and the next-nearest number representable as a machine-precision number.
- $MachineEpsilon is typically 2-n+1, where n is the number of binary bits used in the internal representation of machine‐precision floating‐point numbers.
- $MachineEpsilon measures the granularity of machine‐precision numbers.
Examplesopen allclose all
The result of subtracting $MachineEpsilon/2 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:
Properties & Relations (3)
Neat Examples (1)
The resolution of machine numbers is twice as fine just below 1 versus just above 1: