Floating-point numbers, representation and manipulation

Computer Science A2 · Data Representation. The idea in plain words, the rules to remember, the mistake to avoid and a worked example, written and checked by Mega Lecture.

Test this topic freeAll Computer Science A2 topics

The idea

A real number is stored in two parts: a mantissa, which holds the digits, and an exponent, which says how many places to move the binary point. Value = mantissa × 2exponent. Both parts are in two's complement, and the binary point of the mantissa comes after its first bit.

A number is normalised when the first two bits of the mantissa are different. This gives one form for each value and the greatest precision for the bits available.

Only a limited set of values can be stored exactly. Many fractions, such as 0.1, have no exact binary form, so the stored value is an approximation and rounding errors appear in calculations.

Rules to remember

Common mistake

Students read a negative mantissa as if it were positive. The first bit is worth −1, so 1.0100000 is −1 + 1/4 = −0.75, not 1.25 or −0.25.

Worked example

A number is stored with an 8-bit two's complement mantissa (binary point after the first bit) and a 4-bit two's complement exponent. Mantissa 10100000, exponent 0011. What is the denary value?

  1. Mantissa 1.0100000 = −1 + 1/4 = −0.75.
  2. Exponent 0011 = 3, so multiply by 23 = 8.
  3. −0.75 × 8 = −6.

Answer: −6 (the mantissa starts 10, so the number is normalised).

Ask about this

Type what you are stuck on. The helper finds the explanation, worked examples and the notes to read, free and instant.

Keep going

← File organisation and accessProtocols →Take a Computer Science A2 test