IEEE 754 float32 values in [0, 1] – live WebGPU

Every glowing dot is a real single-precision float generated with the exact hardware formula:

value = (1 + mantissa) × 2exponent
exponent runs from –126 to 0  |  mantissa is a fraction in [0, 1)

Linear scale = true number line → almost all values sit extremely close to zero (the bright bar).
Log scale = position ∝ log₁₀(value) → shows that floats exist at every order of magnitude from ~10⁻³⁸ up to 1.

WebGPU: instance buffer holds every float + phase. Vertex shader maps value → screen X (linear/log) + bobbing. Fragment shader makes soft circles. Additive blending shows density.

Current: Log scale
WebGPU ready · 0 / 0 points
0
1
10⁻³⁰
10⁻²⁰
10⁻¹⁰
10⁻⁵
0.01
0.1

History of Floating-Point & IEEE 754

Floating-point arithmetic is much older than modern computers. The core idea — separating a number into a significand and an exponent — dates back centuries.

Early ideas
• 17th–19th centuries: Logarithmic tables and scientific notation already used the same principle (mantissa + power of 10).
• 1914: Leonardo Torres y Quevedo designed a mechanical electromechanical calculator that used floating-point ideas.
• 1938–1941: Konrad Zuse’s Z1 and Z3 computers used a floating-point binary representation (the first programmable computers to do so).

The Wild West Era (1950s–1970s)

Before a common standard existed, every computer manufacturer invented its own floating-point format:

The Birth of IEEE 754 (1976–1985)

In 1976 Intel was designing a floating-point coprocessor (the 8087) for the upcoming 8086 processor. They hired William Kahan (University of California, Berkeley) as a consultant.

Kahan, together with a group of experts from academia and industry, created a rigorous proposal that became the IEEE 754 standard.

Key timeline
• 1977–1980: Drafting of the standard under the leadership of William Kahan
• 1985: IEEE 754-1985 is officially published
• 2008: Major revision (IEEE 754-2008) adds binary16, binary128, decimal formats, and fused multiply-add
• 2019: Latest revision (IEEE 754-2019) further refines the standard

The standard deliberately chose binary floating-point with a denser distribution of numbers near zero (exactly what you see in the Linear scale of this visualization). This was a conscious engineering decision to favor relative accuracy and a very wide dynamic range.

Why It Mattered

IEEE 754 became one of the most successful standards in computing history. Almost every modern processor, GPU, programming language, and numerical library follows it. This is why the same floating-point calculation usually gives identical results across different machines today — something that was far from guaranteed before 1985.

William Kahan received the Turing Award in 1989 largely for his work on floating-point arithmetic and the IEEE 754 standard. He is often called “the father of floating point.”

Scientific Notation & Computing

In scientific notation a number is written as a significand (also called the mantissa) multiplied by a power of ten (or two in binary).

Example: 5.3266 × 10³
→ The part 5.3266 is the significand (mantissa).
→ The part 10³ is the exponent that scales the value.

Value scaling: The significand carries the precision (the significant digits), while the exponent controls the magnitude (how large or small the number is). Together they let computers represent both very large and very tiny numbers with a fixed number of bits.

In IEEE 754 binary floating-point the significand is stored in normalized form (usually with a leading 1 that is implicit). That is exactly why the formula you see in the visualization is written as (1 + mantissa) × 2exponent.

Color Meaning

Cyan / blue points (left side) = very small floating-point numbers (close to 0).

Pink / magenta points (right side) = floating-point numbers that are relatively close to 1.0 (for example 0.5, 0.75, 0.9, 0.99, etc.).

In Linear scale you see very few pink points because almost all possible float32 values are packed tightly near zero.
In Log scale the pink points become more visible because the scale spreads out the larger magnitudes.

Why This Design Was Intentional

The dense cluster of values near zero that you see on the Linear scale is not an accident — it was a deliberate design choice made by the IEEE 754 committee.

Approach Spacing of numbers Dynamic range Result
Fixed-point Uniform Very limited Not practical for scientific computing
Floating-point (IEEE 754) Denser near zero Extremely wide What we use today

Exact Number of Representable Values

There is a fixed, deterministic number of values that IEEE 754 float32 can represent.

Category Count Notes
Total possible bit patterns 4,294,967,296 (2³²) Every possible 32-bit combination
Distinct finite real numbers 4,278,190,079 Counting +0 and –0 as the same value
Finite bit patterns (incl. ±0) 4,278,190,080 Treating +0 and –0 as distinct
+Infinity and –Infinity 2
NaN payloads 16,777,214 Many different NaN bit patterns

In the closed interval [0, 1] there are exactly 1,056,964,610 distinct non-negative float32 values.

NaN Payloads – The Hidden 16 Million Patterns

When the 8 exponent bits are all 1s and the fraction is non-zero, the value is a NaN (Not a Number). The remaining 23 bits form the payload, giving 16,777,214 different possible NaN patterns.

Original Intent

William Kahan wanted these bits available so software could record why a NaN was created, enabling “retrospective diagnosis” after long calculations.

NaN-Boxing

The most successful modern use is NaN-boxing: dynamic language runtimes (Firefox’s SpiderMonkey, Safari’s JavaScriptCore, LuaJIT, etc.) pack pointers and type tags into the NaN payload of a 64-bit double. This lets every value in the language fit into a single 64-bit register.

Where IEEE 754 Appears in Real Systems

1. CPU & GPU Hardware — Dedicated Floating-Point Units implement the standard in silicon.

2. Compilers — Must respect IEEE rules (or explicitly break them with flags like -ffast-math).

3. Software — Games, ML, scientific computing, finance, graphics… almost everything numerical.

Why This Knowledge Matters + Concrete Examples

Example 1 – Random numbers in [0, 1)

// Bad: biased let r = Math.random(); // Better let r = (Math.random() * 0x1000000) / 0x1000000;

Example 2 – Comparing floating-point numbers

// Dangerous if (a === b) { ... } // Better if (Math.abs(a - b) < 1e-6) { ... }

Example 3 – Denormal performance trap

let x = 1e-40; for (let i = 0; i < 1000000; i++) { x = x * 0.5; // can become extremely slow }

Example 4 – Catastrophic cancellation

let a = 1.0000001; let b = 1.0000000; let diff = a - b; // almost no precision left

References & Further Reading

  1. Wikipedia – IEEE 754
  2. Wikipedia – William Kahan
  3. Wikipedia – NaN
  4. The Secret Life of NaN (excellent article on NaN-boxing)
  5. Stack Overflow – Uses of NaN payloads
  6. Practical NaN-boxing tutorial