Floating point representation: IEEE 754 format and arithmetic explained

Computers store real numbers in a fixed number of bits, so they cannot store every real number exactly. Floating point packs a huge range of magnitudes into 32 or 64 bits by trading away some precision, and IEEE 754 is the standard almost every processor follows. This topic is a dependable source of encoding and precision questions, all resting on the same field layout and normalization rule.

KnowledgeGate Team

Exam prep & CS education

Updated 16 Jul 20266 min read

Computers store real numbers in a fixed number of bits, so they cannot store every real number exactly. Floating point is the scheme that packs a huge range of magnitudes into 32 or 64 bits by trading away some precision, and IEEE 754 is the standard almost every processor follows. This topic is a dependable source of encoding and precision questions, and every one of them rests on the same field layout and normalization rule. That layout is three fields wide, and one of its bits is never actually stored.

Fixed point vs floating point

A fixed-point representation puts the binary point at a fixed position, so many bits go to the integer part and the rest to the fraction. It is simple and fast, but its range is narrow: with the point fixed you cannot represent both very large and very small numbers in the same format.

Floating point instead stores a number as a sign, a fraction, and an exponent, much like scientific notation. Moving the exponent slides the binary point, so the same number of bits covers magnitudes from the tiny to the astronomical. The price is that precision is now relative, not absolute: large numbers are spaced further apart than small ones.

The IEEE 754 fields

IEEE 754 lays out a floating-point number in three fields, in order from the most significant bit.

  • Sign (1 bit): 0 for positive, 1 for negative.

  • Exponent, stored with a bias so it can represent negative exponents without a separate sign.

  • Mantissa, also called the fraction or significand, holding the digits after the leading 1.

The two common precisions divide the bits like this:

Precision

Total bits

Sign

Exponent

Mantissa

Bias

Single

32

1

8

23

127

Double

64

1

11

52

1023

The IEEE 754 single-precision layout: one sign bit, eight biased exponent bits and twenty-three mantissa bits across a 32-bit word.

The bias is what lets a small unsigned exponent field encode a range of positive and negative actual exponents: you store the true exponent plus the bias, and subtract the bias to read it back.

Normalization and the hidden bit

Before storing, the number is normalized to the form 1.fffff times 2 to some power, with exactly one non-zero digit before the binary point. In binary that leading digit is always 1, so IEEE 754 does not store it at all. This hidden bit buys one extra bit of precision for free: the 23-bit single-precision mantissa effectively carries 24 bits of significand.

A worked encoding: put a decimal into IEEE 754 single precision

Encode the decimal value -6.75 in single precision.

  1. Sign. The number is negative, so the sign bit is 1.

  2. Convert the magnitude to binary. 6 is 110, and 0.75 is 0.11, so 6.75 is 110.11 in binary.

  3. Normalize. Shift the binary point to leave one 1 before it: 110.11 becomes 1.1011 times 2 to the power 2. The exponent is 2.

  4. Bias the exponent. Stored exponent is 2 plus 127, which is 129, or 10000001 in 8 bits.

  5. Take the mantissa. Drop the hidden leading 1 and keep the digits after the point, 1011, padded with zeros to 23 bits: 10110000000000000000000.

Assembling sign, exponent and mantissa gives the 32-bit word:

1 10000001 10110000000000000000000

Grouped into hexadecimal that is C0D80000. Reverse the steps and you get -6.75 back exactly, because 6.75 happens to be a sum of powers of two.

Floating point arithmetic: how addition and multiplication work

For addition, you first express both operands with the same exponent. Then you combine their significands, normalize the result, and round it to the available precision.

  1. Write the operands. 1.5 is 1.1 times 2 to the power 0, and 0.25 is 1.0 times 2 to the power minus 2.

  2. Align the exponents. Shift the smaller significand right by two places: 0.01 times 2 to the power 0.

  3. Add the significands. 1.10 plus 0.01 is 1.11, times 2 to the power 0.

  4. Normalize and round. The result already has a single 1 before the point and needs no rounding, so 1.11 in binary is 1.75 in decimal.

Alignment is also where precision quietly disappears. When the two exponents are far apart, shifting the smaller significand right pushes its low-order bits past the stored precision, and they are gone before the addition even happens.

Multiplication needs no alignment. Multiply the significands, add the true exponents, then renormalize and round.

  1. Write the operands. 1.5 is 1.1 times 2 to the power 0, and 3 is 1.1 times 2 to the power 1.

  2. Multiply the significands. 1.1 times 1.1 in binary is 10.01, which is 2.25 in decimal.

  3. Add the exponents. 0 plus 1 is 1, so the raw result is 10.01 times 2 to the power 1.

  4. Renormalize. Shift the point one place left and raise the exponent by one: 1.001 times 2 to the power 2, which is 4.5, exactly 1.5 times 3.

Rounding and the limits of precision

Most decimals are not sums of powers of two, and that is where precision bites. The decimal 0.1 has no finite binary expansion, so IEEE 754 stores the nearest representable value and rounds, which is why 0.1 + 0.2 does not print as exactly 0.3 in most languages. Single precision keeps roughly 7 significant decimal digits and double about 15 to 16. Machine epsilon, the gap between 1 and the next representable single-precision number, is 2 to the power minus 23, and the spacing between consecutive representable numbers is not constant but grows with magnitude.

IEEE 754 also reserves exponent patterns for special values: zero, plus and minus infinity, and NaN for undefined results such as zero divided by zero. When the exponent field is all zeros and the mantissa is nonzero the number is subnormal, meaning the hidden bit is treated as 0 instead of 1, which lets the format represent values gradually smaller than the smallest normalized number instead of jumping straight to zero.

Double precision exists precisely because single precision's seven digits are too few for scientific and financial computation, where the extra mantissa bits keep rounding error under control.

Where this sits, and what it is not

This is the computer organisation view of how a real number is encoded in hardware. It is distinct from the digital-electronics topic of number systems and integer representation, base conversion, and two's complement, which handles whole numbers and signed integers rather than the sign-exponent-mantissa layout here. If you have studied binary conversion and two's complement, this builds directly on that groundwork, but the exam treats float encoding as its own thing. If you have not, start with our number systems and base conversions explainer and come back.

How this is tested in GATE

Floating point representation carries over 130 questions in the KnowledgeGate question bank, part of more than 1,700 across computer organisation. GATE questions typically ask you to encode a given decimal into single or double precision, decode a bit pattern back to a value, count the bits in each field, add two normalized values, or reason about precision, such as the smallest representable positive number or why two nearby reals collapse to the same encoding. Every one of those reduces to the same two moves: normalize to 1.fffff times a power of two, then bias the exponent. The floating point representation learn module has more encodings to work in that shape.

The short version

Floating point stores sign, biased exponent and mantissa. Normalize to 1.fffff times a power of two, drop the hidden leading 1, add the bias to the exponent, and lay the fields out in order. Hand-encode one number like -6.75 into its 32 bits, and remember that most decimals only round to the nearest representable value. Do that and the encoding, arithmetic and precision questions become routine.