Home

ULP

ulp stands for unit in the last place. In floating-point arithmetic, ulp(x) is the distance between x and the next representable floating-point number greater than x, i.e., the gap to nextafter(x, +inf). This quantity measures the spacing of representable numbers near x and is always nonnegative. It can be used to assess the potential rounding error when x is subjected to arithmetic operations.

In IEEE 754 binary formats, the spacing depends on the magnitude of x. For a format with

Relation to error analysis: ulp is related to machine epsilon, which is ulp(1). It provides a local

Implementation and usage: Some languages provide a dedicated ulp function, such as Math.ulp in Java, to return

p-bit
significand,
the
typical
gap
between
consecutive
normal
numbers
in
the
same
binade
[2^k,
2^{k+1})
is
about
2^{k
-
p
+
1}.
As
x
approaches
zero,
the
presence
of
subnormal
numbers
reduces
gaps,
and
ulp(0)
equals
the
distance
to
the
smallest
positive
subnormal
value.
For
infinities
and
NaN,
ulp
is
not
defined
in
the
same
way.
measure
of
rounding
error
and
is
used
to
bound
relative
errors,
compare
floating-point
values,
and
guide
numerical
algorithms
that
require
precision
control.
Because
ulp
varies
with
x,
absolute
tolerances
must
scale
with
ulp
when
working
across
a
wide
range
of
magnitudes.
ulp(x).
Other
environments
rely
on
the
concept
of
machine
epsilon
or
implement
ulp
via
nextafter
operations.
Understanding
ulp
helps
in
debugging
numerical
issues
and
in
designing
robust
floating-point
computations.