What is IEEE 754?

The international standard defining floating-point formats and arithmetic, including single (32-bit) and double (64-bit) precision, rounding, and special values such as infinity and NaN, so results agree across computers.

Field: Computer Arithmetic

Japanese name: IEEE 754

IEEE 754 single-precision bit layout 31 30 23 22 0 s e f Sign Exponent (8 bits) Fraction (23 bits) 1 bit Add bias 127 Leading 1 omitted (hidden bit) Value = (−1)^s × 1.f × 2^(e − 127) e.g. −6.5 = −110.1₂ = −1.101₂ × 2² 1 10000001 10100000000000000000000 Neg. e = 2 + 127 = 129 “101” followed by 0s In hex: 0xC0D00000
IEEE 754 single-precision bit layout · View in diagrams

How the bits encode a value

A binary IEEE 754 number stores a sign bit, a biased exponent field and a fraction, and for normal numbers represents (−1)^sign × 1.fraction × 2^(exponent − bias). Single precision (FP32) uses 1, 8 and 23 bits with a bias of 127; double precision (FP64) uses 1, 11 and 52 bits with a bias of 1023. The leading 1 is implied (the hidden bit), giving 24 and 53 bits of precision, about 7 and 15–16 decimal digits. For example, 1.0 has a stored exponent of 127 and an all-zero fraction, which is 0x3F800000 in FP32.

Special values and exceptions

The extreme exponent codes are reserved. An all-zero exponent encodes ±0 and subnormal numbers, which drop the hidden 1 to fill the gap below the smallest normal value with evenly spaced tiny values (gradual underflow). An all-ones exponent encodes ±infinity when the fraction is zero and NaN (not a number) otherwise. Dividing a nonzero number by zero gives infinity, while 0 ÷ 0 or ∞ − ∞ gives NaN, which compares unequal even to itself. +0 and −0 compare equal but dividing a positive number by +0 gives +∞ and by −0 gives −∞. By default these events set status flags instead of stopping the program.

Rounding and precision limits

The basic operations, including addition, multiplication, division and square root, must be correctly rounded: the result equals the exact value rounded to a representable one. The default mode rounds to nearest with ties to even, which avoids a systematic upward drift. Machine epsilon, the gap above 1.0, is 2⁻²³ (about 1.19 × 10⁻⁷) in FP32 and 2⁻⁵² in FP64, and every integer is exact only up to 2²⁴ and 2⁵³ respectively. Decimal fractions such as 0.1 are not exactly representable, and floating-point addition is not associative, so results should be compared with a tolerance.

Floating point vs. fixed point

Fixed-point numbers have uniformly spaced values, so absolute error is constant and the range is narrow. Floating point keeps the relative error roughly constant across an enormous range, about 10⁻³⁰⁸ to 10³⁰⁸ for FP64, at the cost of more complex hardware for alignment, normalization and rounding. The standard also defines half precision with a 5-bit exponent and a fused multiply-add that rounds only once. Machine-learning hardware often uses bfloat16, which keeps FP32's 8-bit exponent with a 7-bit fraction; it follows the same encoding ideas but is not one of the standard's formats.

Try it: questions about IEEE 754

Which three parts make up an IEEE 754 floating-point number?

  1. ASign, exponent and significand
  2. BInteger part, fractional part and carry
  3. CHigh byte, low byte and parity
Show answer and explanation

Answer: A. Sign, exponent and significand

A floating-point number represents a normal value as (−1)^sign × 1.significand × 2^exponent and stores three parts: a sign bit for positive or negative, an exponent field for the power of two, and a significand for the significant digits. Because the exponent moves the binary point, the same number of bits covers values from tiny to huge. Splitting into integer and fractional parts is the fixed-point idea, and parity is for error detection.

How are the bits of an IEEE 754 single-precision (32-bit) number allocated among sign, exponent and significand?

  1. A1, 11, 20
  2. B1, 8, 23
  3. C1, 5, 26
Show answer and explanation

Answer: B. 1, 8, 23

Single precision (FP32) uses 1 sign bit, 8 exponent bits and 23 significand bits, 32 in total. For normalized numbers the leading 1 of the significand is implied, so precision is 24 bits, about seven decimal digits. Double precision (FP64) uses 1, 11 and 52 bits, with a wider exponent and higher precision. 1, 11, 20 confuses it with double precision's exponent width, and 1, 5, 26 with half precision's.

FAQ

Why does 0.1 + 0.2 not equal 0.3 in floating point?

None of these decimal values has an exact binary representation, so each is stored rounded and the rounding errors do not cancel. In double precision the sum comes out as 0.30000000000000004, so equality tests should use a tolerance.

What is the exponent bias in IEEE 754 single precision?

The bias is 127, so the true exponent is the stored 8-bit value minus 127. Stored values 0 and 255 are reserved for zero, subnormals, infinity and NaN, leaving 1–254 for normal numbers.

Why is NaN not equal to itself?

IEEE 754 defines every comparison involving NaN as unordered, so x == x is false when x is NaN. Use a dedicated function such as isnan rather than relying on this trick.

Questions that mention IEEE 754 (12)

IEEE 754 appears in 14 practice questions across 1 topic, including Computer Arithmetic.

  1. In IEEE 754 double precision (64-bit), how many bits are the exponent and significand?
  2. In IEEE 754 single precision, if the stored exponent field is 130, what is the actual exponent (power of two)?
  3. What is the effect of not storing the leading 1 of the significand (the hidden bit) in IEEE 754 normalized numbers?
  4. What is the hexadecimal bit pattern of decimal 1.0 in IEEE 754 single precision?
  5. What is the machine epsilon (the gap between 1 and the next larger representable number) in IEEE 754 single precision?
  6. What is the role of IEEE 754 subnormal numbers?
  7. Under IEEE 754, what result does the standard specify for dividing a positive number by +0?
  8. In IEEE 754 single precision, what do bit patterns with an all-ones exponent field (255) represent?
  9. Which correctly describes +0 and −0 in IEEE 754 floating point?
  10. Which rounding method does IEEE 754 specify as the default?
  11. Up to what value can IEEE 754 single precision represent every integer exactly, starting from 0?
  12. When x is NaN, what does evaluating x == x give in most programming languages?

Books on Computer Arithmetic Ad

As an Amazon Associate I earn from qualifying purchases.

Comparisons that include this term

Semiconductor, Electronics and Computing Calculators

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary