ULP / Float Spacing Explorer — Gap Between Representable Floats

See the spacing between floating-point numbers: the ULP (unit in the last place) at any value, the next representable float up and down, the exact gap, and how many representable floats lie between two numbers — single (32-bit) or double (64-bit), live in your browser.

Calculator Number Systems Updated Jun 21, 2026
How to Use
  1. Pick the precision — 32-bit single or 64-bit double.
  2. Type a number (try 1, 0.1, 16777216, or 4503599627370496) to see its ULP.
  3. Read the next representable float upward (nextafter toward +∞) and downward, with the exact gap from your value.
  4. Optionally enter a second value to count how many representable floats lie between the two — click any result to copy it.
ULP at this value (gap to the next float)

Floating-point numbers are discrete — and unevenly spaced

It is tempting to picture floating-point numbers as a smooth slice of the real line, but they are a finite, discrete set: between any two adjacent floats there is a gap with nothing representable inside it. The size of that gap is the ULP — the “unit in the last place”, the weight of the lowest mantissa bit at that magnitude. Formally ULP(x) = nextUp(x) − x, where nextUp is the next representable value toward +∞ (the C library’s nextafter(x, +∞)). This explorer computes it by reinterpreting your number’s bits as an integer and adding 1 to that bit pattern — bump the integer, reinterpret as a float, and you land exactly on the neighbour, with no rounding of your own.

Why the gap doubles with magnitude

Every float is a fixed-width mantissa (23 bits for single, 52 for double) scaled by a power of two taken from the exponent. Hold the mantissa width fixed and the spacing has to scale with that power: each time the exponent rises by one, the ULP doubles. Near 1.0 a double’s ULP is 2⁻⁵² ≈ 2.22 × 10⁻¹⁶ (this exact value is machine epsilon); near 1000 it is about 10⁻¹³; and once you pass 2⁵² = 4,503,599,627,370,496 the ULP is exactly 1.0 — so beyond that point a double can no longer represent every integer, and above 2⁵³ the gap is 2.0. For a 32-bit single the same wall arrives far sooner: at 2²⁴ = 16,777,216 the ULP is already 2.0. That is why a large running total can silently stop changing when you add a small amount to it.

Counting the floats between two values

Because the bit pattern of a positive float increases monotonically as the float increases, the count of representable values between two numbers is simply the difference of their integer bit patterns. Enter a second value and the tool reports exactly how many distinct floats lie in the interval — a concrete measure of how much resolution you have to work with there. This is also the cleanest way to express a tolerance: instead of guessing an absolute epsilon, you can say two results are “within N ULPs” of each other, which stays meaningful whether the numbers are tiny or huge. Half a ULP is the most any single correctly-rounded operation can be off, so ULP distance is the natural currency of numerical error.

Quick reference

ULP definition
ULP(x) = nextUp(x) − x
nextUp(x)
bit pattern + 1 (x > 0)
ULP(1.0) double
2⁻⁵² ≈ 2.22e-16
ULP(1.0) single
2⁻²³ ≈ 1.19e-7
Gap = 1.0 (double)
above 2⁵² = 4503599627370496
Gap = 2.0 (single)
above 2²⁴ = 16777216
Machine epsilon
= ULP(1.0)
Max rounding error
½ ULP per operation

About the ULP / Float Spacing Explorer — Gap Between Representable Floats

ULP / Float Spacing Explorer — Gap Between Representable Floats is a quick, free tool for everyday tasks. It works in your browser and keeps everything on your device. See the spacing between floating-point numbers: the ULP (unit in the last place) at any value, the next representable float up and down, the exact gap, and how many representable floats lie between two numbers — single (32-bit) or double (64-bit), live in your browser.

How it works

Enter your figures and the result appears instantly, updating the moment you change anything. There is no submit button and nothing to wait for, so it is easy to try a few what-if numbers and compare the results. Just check each box holds the kind of value it expects.

Want the deeper story? The Knowledge Base explains the ideas behind the tools in more detail.

Frequently Asked Questions

What is a ULP?

ULP stands for “unit in the last place” — the gap between a floating-point number and the next representable one. It is the value of the lowest mantissa bit at that magnitude. ULP(x) = nextUp(x) − x. For a double, ULP(1.0) = 2⁻⁵² ≈ 2.22e-16; for a single, ULP(1.0) = 2⁻²³ ≈ 1.19e-7. Rounding error in any operation is at most half a ULP.

What does “next representable float” mean?

Floating-point numbers are discrete: between any two of them there is a gap with nothing representable inside. The next float upward is what the C function nextafter(x, +∞) returns, and the next downward is nextafter(x, −∞). This tool computes them by reinterpreting the bits as an integer and adding or subtracting 1 from that bit pattern — the exact same trick the standard library uses.

Why does the gap grow as numbers get bigger?

Floats keep a fixed number of mantissa bits (23 for single, 52 for double) and scale them by a power of two from the exponent. So the spacing doubles every time the exponent goes up by one. Below 2 the double ULP is ~2.2e-16, but just above 2⁵² (4,503,599,627,370,496) it is exactly 1.0 — integers above that point cannot all be stored — and above 2⁵³ it is 2.0.

How is this different from machine epsilon?

Machine epsilon is the ULP at exactly 1.0 (2⁻⁵² for double, 2⁻²³ for single) — a single fixed constant. The ULP this tool shows is the local spacing at whatever value you enter, which changes with magnitude. Epsilon is just the special case ULP(1.0).

Is anything uploaded?

No. Everything is computed in your browser with typed arrays — a DataView reinterprets the float as a 64-bit (or 32-bit) integer and bumps the bit pattern by ±1 — so the results are bit-for-bit what your CPU’s nextafter would produce. Nothing is sent to a server.

How do I use the ULP / Float Spacing Explorer — Gap Between Representable Floats?

Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.

Does it cost anything or need an account?

No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.

Is anything I type uploaded?

No. The tool works entirely on your device, so the values you enter never leave your browser.

Common Use Cases

Debugging precision loss

See exactly how coarse the spacing is at a given magnitude, so you know when a sum or counter can no longer change by 1.

Choosing comparison tolerances

Pick an epsilon for “almost equal” tests based on the real ULP at the values you compare, not a guessed constant.

Learning floating point

Watch the gap double across exponents and find the famous boundaries at 2²⁴ (single) and 2⁵² / 2⁵³ (double).

Numerical analysis

Count the representable floats between two values to reason about loop step sizes and accumulated error.

Last updated: