$MachineEpsilon

$MachineEpsilon

gives the difference between 1.0 and the next-nearest number representable as a machine-precision number.

Details

  • $MachineEpsilon is typically 2-n+1, where n is the number of binary bits used in the internal representation of machineprecision floatingpoint numbers.
  • $MachineEpsilon measures the granularity of machineprecision numbers.

Examples

open allclose all

Basic Examples  (1)

The result of adding 1 to $MachineEpsilon is distinct from 1:

Adding a fraction of $MachineEpsilon effectively results in rounding:

Scope  (2)

The result of subtracting $MachineEpsilon/2 from 1 is distinct from 1:

Find machine epsilon algorithmically:

Applications  (2)

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)

$MachineEpsilon is a power of 2:

$MachineEpsilon is twice 10-MachinePrecision:

This is effectively where is the number of bits of machine precision:

1 and 1+$MachineEpsilon differ only in the least significant bit:

Neat Examples  (1)

The resolution of machine numbers is twice as fine just below 1 versus just above 1:

Wolfram Research (1991), $MachineEpsilon, Wolfram Language function, https://reference.wolfram.com/language/ref/$MachineEpsilon.html.

Text

Wolfram Research (1991), $MachineEpsilon, Wolfram Language function, https://reference.wolfram.com/language/ref/$MachineEpsilon.html.

CMS

Wolfram Language. 1991. "$MachineEpsilon." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$MachineEpsilon.html.

APA

Wolfram Language. (1991). $MachineEpsilon. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$MachineEpsilon.html

BibTeX

@misc{reference.wolfram_2024_$machineepsilon, author="Wolfram Research", title="{$MachineEpsilon}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/$MachineEpsilon.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_$machineepsilon, organization={Wolfram Research}, title={$MachineEpsilon}, year={1991}, url={https://reference.wolfram.com/language/ref/$MachineEpsilon.html}, note=[Accessed: 21-November-2024 ]}