Math & science

Floating-Point Explorer

See how IEEE-754 half/single/double store a number: bits, exact value, ULP, rounding error.

A decimal (0.1, -6.02e23), an expression with + − * / and parentheses, NaN / Infinity, or a bit pattern 0x… / 0b….

Try an example: 0.1 as a double · 0.1 + 0.2 ≠ 0.3 · Smallest half-precision subnormal · 16777217 as a float

How it works

Shows the sign, exponent and fraction bits of a decimal number in IEEE-754 binary16, binary32 or binary64, the exact decimal value that is actually stored (computed with big integers), the rounding error, the ULP and the neighbouring representable numbers. Evaluates expressions such as 0.1 + 0.2 step by step and explains subnormals, infinities and NaN.

  • Decimal input is parsed as an exact fraction and rounded to the nearest representable value of the chosen format (round half to even), with big-integer arithmetic, so there is no double rounding via JavaScript numbers.
  • A normal number is (−1)^sign × 1.fraction × 2^(exponent − bias); subnormals (exponent field 0) are (−1)^sign × 0.fraction × 2^(1 − bias). The exact decimal of the stored value always terminates because the denominator is a power of two.
  • ULP is the gap to the next representable number away from zero; the neighbours are the bit patterns ±1 (crossing between ±0 and the smallest subnormals).
  • Expressions are evaluated twice: exactly with fractions, and in the chosen format with rounding after every literal and every operation (IEEE-754 semantics, like JavaScript for binary64 or C float for binary32).

Sources

For scripts and AI agents

  • JSON API: POST https://floatingpointexplorer.usefulweb.site/api/v1/calculate (same calculation as this page)
  • Interface description: OpenAPI 3.1 · AI guide: llms.txt
  • MCP server (Streamable HTTP): https://floatingpointexplorer.usefulweb.site/mcp · tool name floating_point_explorer
Example request
curl -s -X POST https://floatingpointexplorer.usefulweb.site/api/v1/calculate \
  -H 'content-type: application/json' \
  -d '{"value":"0.1","format":"binary64"}'

Related tools

  • Number-Theory Lab – Primality, factorisation, gcd, modular arithmetic, CRT, φ, π(n), Collatz, continued fractions.
Feedback