Written and maintained by CASRAI Editorial Board
Last updated
Short answer. In MATLAB, “epsilon” means one of two different things. The function eps returns floating-point spacing (machine epsilon), and epsilon in graph text draws the Greek letter ε. This guide covers both, so you can pick the one you need.
The page is for researchers and analysts who compute with MATLAB and need to (a) find the spacing of floating-point numbers, (b) choose a sensible tolerance, or (c) put ε in a plot label. Facts below come from the MathWorks documentation, the GNU Octave manual and the NumPy documentation, read 2026-11-07.
What epsilon is used for in research
eps: machine epsilon and floating-point spacing
eps is the MATLAB function for “floating-point relative accuracy”. With no argument it returns 2-52, the distance from 1.0 to the next larger double-precision number, which is 2.2204e-16. eps(x) returns the positive distance from abs(x) to the next larger floating-point number of the same precision as x. Numerical analysts use it to judge rounding error, to set convergence tolerances, and to understand why two computed values that should be equal differ in the last digits.
The epsilon symbol in plots
The second meaning is typographic. Text in titles, legends and axis labels can contain Greek letters through an interpreter. Text objects use the tex interpreter by default, and epsilon renders as ε in the MathWorks tex character table.
Which one do I need?
- You want a number (a tolerance, a spacing, a precision check): use
eps. - You want the letter ε on a figure: use
epsilonin a text string. - You want a variable called epsilon in your own script: name it something that does not shadow the built-in, for example
tol. A variable namedepshides the function in that workspace.
Install or access (official source only)
MATLAB is a MathWorks product, available from mathworks.com. The reference page for the function is eps, Floating-point relative accuracy. GNU Octave, a separate free program, also provides eps; its manual is at docs.octave.org.
Step by step: using eps in MATLAB
Machine epsilon (eps, epsilon in MATLAB)
- Type
epsin the Command Window and press Enter. The result is2.2204e-16. - Check that it is a power of two:
log2(eps)returns-52. - Get the single-precision value with
eps("single"), which returns single1.1921e-07. It matcheseps(single(1.0)), andlog2(eps("single"))returns single-23. - Get the spacing at a specific number with
eps(x). For exampleeps(10.0)returns1.7764e-15andeps(single(10.0))returns single9.5367e-07. - To match the precision, type, sparsity and complexity of an existing array
p, useeps(like=p).
The four documented syntaxes are d = eps, d = eps(x), d = eps(typename) (where typename is "double", the default, or "single") and d = eps(like=p).
The ε symbol in a title or legend (matlab epsilon symbol)
- Create your plot.
- Put
epsiloninside a text string, for example in a title or legend label. With the default tex interpreter it renders as ε. - For LaTeX-style math, set the interpreter explicitly:
title(str,'Interpreter','latex')orlegend(label1,label2,'Interpreter','latex'). For tick labels setax.TickLabelInterpreter='latex'. LaTeX strings are wrapped in dollar signs, as in the MathWorks examplestr = 'Estimates $hat{psi_1}$ ...'.
For the underlying LaTeX commands, see the CASRAI guide to Greek symbols in LaTeX. Related MATLAB plotting guides: MATLAB subplot layouts and scatter plots in MATLAB.
Output and how to read it
eps(x) spacing by magnitude
The spacing between representable numbers is not constant. It grows with the size of the number, so a double near 1e10 is far coarser than a double near 1. The values below are those printed in the MathWorks documentation.
| Call | Class | Result |
|---|---|---|
eps (same as eps(1)) |
double | 2.2204e-16 |
eps(5) |
double | 8.8818e-16 |
eps(10.0) |
double | 1.7764e-15 |
eps(1e10) |
double | 1.9073e-06 |
eps("single") |
single | 1.1921e-07 |
eps(single(5)) |
single | 4.7684e-07 |
eps(single(10.0)) |
single | 9.5367e-07 |
Reading the table: “you cannot represent numbers between 5 and 5 + eps(5) in double-precision format”, in the documentation’s words. Double precision uses 1 sign bit, 11 exponent bits and 52 mantissa bits; single uses 1, 8 and 23, which is why log2 of the two eps values is -52 and -23.
The flintmax edge
flintmax is the largest consecutive integer that floating point represents exactly: 253 (about 9.0072e+15) for double and 224 (16777216) for single. At that point eps(flintmax) equals 2, so flintmax + 1 rounds back to flintmax.
Special inputs
eps(x) equals eps(-x) and eps(abs(x)). If x is Inf or NaN, the result is NaN.
Troubleshooting
Two results that “should be equal” are not
Floating-point arithmetic rounds results to a representable value, and == asks whether two values are the identical floating-point number. A common alternative is to compare the difference to a tolerance, such as abs(a - b) < tol. Scaling the tolerance with eps(max(abs(a), abs(b))) ties it to the actual spacing at that magnitude, whereas plain eps is only the spacing near 1. This is a practical convention built on the eps(x) definition, not a rule stated in the documentation, and the right tolerance depends on your algorithm.
The ε symbol shows as text
If epsilon prints literally, check which interpreter applies. The default tex interpreter handles epsilon; with the latex interpreter, wrap the expression in dollar signs. Also confirm the interpreter was not set to 'none'.
A variable overwrites the function
If eps(x) errors or returns a stored value, a variable named eps may exist in the workspace. Run clear eps and rename the variable.
Free alternatives
| Tool | Equivalent | What the official documentation says |
|---|---|---|
| GNU Octave | eps, eps(x), eps(..., class) |
Returns machine precision; on IEEE 754 machines eps(1.0) is about 2.2204e-16 (double) and 1.1921e-07 (single). Class options are “double” (default) or “single”. Source: Octave manual, read 2026-11-07. |
| Python with NumPy | numpy.finfo(float).eps |
The difference between 1.0 and the next larger float; for 64-bit IEEE-754 binary floats it is 2**-52, about 2.22e-16. Source: NumPy documentation, read 2026-11-07. |
MATLAB and Octave offer eps(x) for the spacing at any x, while the NumPy attribute reports the value at 1.0.
FAQ
What is epsilon in MATLAB?
Either the eps function, which gives floating-point spacing (2.2204e-16 for double at 1.0), or the Greek letter ε typed as epsilon in plot text.
How do I get single-precision epsilon?
Use eps("single"), which returns single 1.1921e-07.
Is MATLAB epsilon the same at every number?
No. eps(x) depends on x: eps(5) is 8.8818e-16 and eps(1e10) is 1.9073e-06.
How do I put epsilon in a legend?
Include epsilon in the label string for the default tex interpreter, or use the latex interpreter with dollar-delimited math.
Sources
- MathWorks: eps (Floating-point relative accuracy), read 2026-11-07.
- MathWorks: Floating-Point Numbers, read 2026-11-07.
- MathWorks: Greek Letters and Special Characters in Graph Text, read 2026-11-07.
- GNU Octave manual: Mathematical Constants, read 2026-11-07.
- NumPy: numpy.finfo, read 2026-11-07.
Related reading: linspace in MATLAB and printing output in MATLAB.







