Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical & Research SuppliesReagents, PPE & instruments — chain-of-custody documented.Fast, traceable sourcing built for regulated research environments, from bench consumables to instrumentation.Shop lac.us CodeCASRAIlac.us

Epsilon in MATLAB: eps, Machine Epsilon and the ε Symbol

What epsilon means in MATLAB: the eps function (machine epsilon, spacing by magnitude) versus the ε symbol in figure text, with Octave and NumPy equivalents.

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 epsilon in 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 named eps hides 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)

  1. Type eps in the Command Window and press Enter. The result is 2.2204e-16.
  2. Check that it is a power of two: log2(eps) returns -52.
  3. Get the single-precision value with eps("single"), which returns single 1.1921e-07. It matches eps(single(1.0)), and log2(eps("single")) returns single -23.
  4. Get the spacing at a specific number with eps(x). For example eps(10.0) returns 1.7764e-15 and eps(single(10.0)) returns single 9.5367e-07.
  5. To match the precision, type, sparsity and complexity of an existing array p, use eps(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)

  1. Create your plot.
  2. Put epsilon inside a text string, for example in a title or legend label. With the default tex interpreter it renders as ε.
  3. For LaTeX-style math, set the interpreter explicitly: title(str,'Interpreter','latex') or legend(label1,label2,'Interpreter','latex'). For tick labels set ax.TickLabelInterpreter='latex'. LaTeX strings are wrapped in dollar signs, as in the MathWorks example str = '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

Related reading: linspace in MATLAB and printing output in MATLAB.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Epsilon in MATLAB: eps, Machine Epsilon and the ε Symbol

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →