IEEE 754 Floating-Point Representation: Explanation and Worked Examples

IEEE 754 Floating-Point Representation: Explanation and Worked Examples

Verified Sources
Nov 4, 2026

IEEE 754 defines how real numbers are encoded as fixed-width binary values, so that computers can approximate real arithmetic with predictable rules for normalization, rounding, and special cases (e.g., ±0\pm 0, infinities, NaNs). The core idea is that a floating-point number is represented as a sign plus an exponent plus a significand (mantissa) with an implied binary structure. Key concepts include: floating-point representation , significand , exponent bias , and subnormal number.

The IEEE 754 value formula for normalized numbers (base 2) has the form:

(−1)s×(1.f)×2E−B(-1)^s \times (1.f) \times 2^{E-B}

where:

  • ss is the sign bit,
  • ff is the fraction field interpreted as a binary fraction,
  • EE is the stored exponent interpreted as an integer,
  • BB is the exponent bias (e.g., 127 for binary32, 1023 for binary64).

IEEE 754 also defines encodings for:

  • ±0\pm 0: exponent and fraction fields are all zero,
  • subnormals: exponent field is zero but fraction is nonzero,
  • infinities: exponent all ones and fraction all zeros,
  • NaN (Not a Number): exponent all ones and fraction nonzero.

These rules make representations comparable in a consistent way and ensure operations follow the standard’s rounding behavior.

4

Footnotes

  1. IEEE 754 overview and rounding concepts (IEEE 754 standard explanation) https://en.wikipedia.org/wiki/IEEE_754 - Describes IEEE 754 floating-point formats, special values, and rounding concepts. ↩

  2. IEEE 754 binary32 details https://en.wikipedia.org/wiki/IEEE_754#Single-precision:_binary32 - Field sizes (1/8/23), exponent bias 127, and special-case classification. ↩

  3. IEEE 754 binary64 details https://en.wikipedia.org/wiki/IEEE_754#Double-precision:_binary64 - Field sizes (1/11/52) and exponent bias 1023, plus normalized/subnormal structure. ↩

  4. Rounding modes and round-to-nearest ties-to-even https://en.wikipedia.org/wiki/IEEE_754#Rounding - Explains IEEE 754 rounding rules, including round-to-nearest and ties-to-even. ↩

IEEE 754 Floating Point Explained (binary32/binary64, special cases)

IEEE 754 formats (binary32 and binary64)

Two common IEEE 754 formats are:

  • binary32 (commonly called “single precision”): 32 bits total,
  • binary64 (commonly called “double precision”): 64 bits total.

binary32 (single precision)

It uses:

  • 1 sign bit,
  • 8 exponent bits,
  • 23 fraction bits.

The exponent bias is B=127B=127 and the stored exponent EE is interpreted as:

  • if 0<E<2550<E<255: normalized,
  • if E=0E=0: subnormal or zero,
  • if E=255E=255: infinity or NaN. binary32

binary64 (double precision)

It uses:

  • 1 sign bit,
  • 11 exponent bits,
  • 52 fraction bits.

The exponent bias is B=1023B=1023 and the same exponent-field classification idea applies with exponent all-ones and all-zeros. binary64

2

Footnotes

  1. IEEE 754 binary32 details https://en.wikipedia.org/wiki/IEEE_754#Single-precision:_binary32 - Field sizes (1/8/23), exponent bias 127, and special-case classification. ↩

  2. IEEE 754 binary64 details https://en.wikipedia.org/wiki/IEEE_754#Double-precision:_binary64 - Field sizes (1/11/52) and exponent bias 1023, plus normalized/subnormal structure. ↩

Worked example (binary32): encode and decode 13.25

  1. 1
    Step 1

    Convert 13.2513.25 to binary: 1310=1101213_{10}=1101_2 and 0.25=0.0120.25=0.01_2, so 13.25=1101.01213.25=1101.01_2.

  2. 2
    Step 2

    For IEEE 754 normalized numbers, the significand is 1.f1.f. So shift: 1101.012=1.101012×231101.01_2 = 1.10101_2 \times 2^3. Thus the exponent is k=3k=3 and f=10101...f=10101... (remaining bits padded with zeros).

  3. 3
    Step 3

    The number is positive, so s=0s=0.

  4. 4
    Step 4

    For binary32, bias B=127B=127. Stored exponent is E=k+B=3+127=130E = k + B = 3 + 127 = 130. In binary, 130=100000102130=10000010_2.

  5. 5
    Step 5

    The fraction field stores bits after the leading 1 in 1.f1.f. Here f=10101f=10101 followed by zeros to fill 23 bits: fraction = 10101000…10101000\ldots (exactly 23 bits total).

  6. 6
    Step 6

    Bit layout: [s][E(8bits)][fraction(23bits)]=[0][10000010][10101000000000000000000][s][E(8 bits)][fraction(23 bits)] = [0][10000010][10101000000000000000000] (fraction padded with zeros).

  7. 7
    Step 7

    "Decoding yields (−1)0×(1.101012)×2130−127=1.101012×23=1101.012=13.2510(-1)^0 \times (1.10101_2) \times 2^{130-127} = 1.10101_2 \times 2^3 = 1101.01_2 = 13.25_{10}."

    This example matches IEEE 754’s normalized-number rule and binary32 field sizes. normalized

    2

    Footnotes

    1. IEEE 754 binary32 details https://en.wikipedia.org/wiki/IEEE_754#Single-precision:_binary32 - Field sizes (1/8/23), exponent bias 127, and special-case classification. ↩

    2. IEEE 754 binary64 details https://en.wikipedia.org/wiki/IEEE_754#Double-precision:_binary64 - Field sizes (1/11/52) and exponent bias 1023, plus normalized/subnormal structure. ↩

Worked example (binary32): interpret a special value (∞\infty and NaN)

IEEE 754 uses exponent all ones to represent special values:

  • exponent all ones and fraction all zeros ⇒\Rightarrow ±∞\pm\infty,
  • exponent all ones and fraction nonzero ⇒\Rightarrow NaN.

For binary32:

  • exponent field = 255255 (all ones),
  • fraction field = all zeros ⇒\Rightarrow infinity,
  • fraction field ≠0\neq 0 ⇒\Rightarrow NaN (payload varies by fraction bits). NaN

Concrete bit patterns (conceptual):

  • s=0s=0, E=255E=255, fraction=0 ⇒+infty\Rightarrow +\\infty,
  • s=1s=1, E=255E=255, fraction=0 ⇒−infty\Rightarrow -\\infty.

Footnotes

  1. IEEE 754 binary32 details https://en.wikipedia.org/wiki/IEEE_754#Single-precision:_binary32 - Field sizes (1/8/23), exponent bias 127, and special-case classification. ↩

Subnormal numbers (underflow region) and the hidden-leading-1 rule

For normalized IEEE 754 numbers, the significand has an implicit leading 1: (1.f)(1.f). For subnormals, the implicit leading 1 is removed and the value uses (0.f)(0.f) with a different effective exponent (effectively 21−B2^{1-B} as the minimum normal exponent). This allows representing values closer to zero than the smallest normal number, at reduced precision. subnormal

In classification terms for binary32:

  • exponent field E=0E=0 and fraction=0 ⇒\Rightarrow ±0\pm 0,
  • exponent field E=0E=0 and fraction≠0\neq 0 ⇒\Rightarrow subnormal.

2

Footnotes

  1. IEEE 754 binary32 details https://en.wikipedia.org/wiki/IEEE_754#Single-precision:_binary32 - Field sizes (1/8/23), exponent bias 127, and special-case classification. ↩

  2. Rounding modes and round-to-nearest ties-to-even https://en.wikipedia.org/wiki/IEEE_754#Rounding - Explains IEEE 754 rounding rules, including round-to-nearest and ties-to-even. ↩

IEEE 754 binary32 field sizes and biases

Common layout: sign, exponent, fraction; exponent bias is used to map stored exponent to E−BE-B.

Common pitfalls and precise interpretation rules

Pro Tip

When decoding: first classify by the exponent field (all zeros, all ones, or middle). Only after classification should you apply (1.f)(1.f) vs (0.f)(0.f) and the correct exponent formula.

Beware of “fraction bits” vs the significand

The fraction field alone is not the significand for normalized numbers. The actual significand is (1.f)(1.f) where ff comes from the fraction bits; for subnormals it is (0.f)(0.f). Misreading this is the most common error.

Mental workflow for using IEEE 754 representations

Parse fields

1) Extract bits

Read sign, exponent, fraction from the fixed-width pattern."

Decide the case

2) Classify exponent

If exponent=0, exponent=all-ones, or exponent in-between => zero/subnormal, infinity/NaN, or normalized."

Compute the value

3) Apply the right formula

Use (1.f)(1.f) for normalized and (0.f)(0.f) for subnormals, plus the correct exponent offset."

Normalize and bias

4) For encoding, reverse the steps

Convert to binary, normalize to 1.f×2k1.f\times2^k, set E=k+BE=k+B, then round if needed."

2

Footnotes

  1. IEEE 754 binary32 details https://en.wikipedia.org/wiki/IEEE_754#Single-precision:_binary32 - Field sizes (1/8/23), exponent bias 127, and special-case classification. ↩

  2. IEEE 754 binary64 details https://en.wikipedia.org/wiki/IEEE_754#Double-precision:_binary64 - Field sizes (1/11/52) and exponent bias 1023, plus normalized/subnormal structure. ↩

Rounding: why examples may not terminate exactly in binary

Even when you can express a decimal as an exact rational (like 13.2513.25), many decimals do not have a finite binary expansion. IEEE 754 specifies rounding rules (commonly “round to nearest, ties to even”) so that the result is the closest representable float, with a deterministic tie-break rule. This is crucial for reproducibility and predictable errors. round-to-nearest

Footnotes

  1. Rounding modes and round-to-nearest ties-to-even https://en.wikipedia.org/wiki/IEEE_754#Rounding - Explains IEEE 754 rounding rules, including round-to-nearest and ties-to-even. ↩

Knowledge Check

Question 1 of 4
Q1Single choice

In IEEE 754 binary32, how many bits are used for the fraction (mantissa) field?