Floating Point Binary

What is floating point binary?

  • Floating point binary addresses the limitations of fixed-point binary in representing a wide array of real numbers
  • It allows for both fractional and whole-number components
  • It accommodates extremely large and small numbers by adjusting the floating point
  • It optimises storage and computational resources for most applications

Mantissa and exponent

  • In A Level Computer Science, the mantissa and exponent are the two main components of a floating point number:
    • Mantissa
      • The part of the number that holds the actual digits of the value
      • It represents the precision of the number but does not determine its scale
    • Exponent
      • Controls how far the binary point moves, effectively scaling the number up or down
      • A larger exponent moves the point to the right (making a larger number), while a smaller exponent moves it to the left (making a smaller number)
  • For example, in standard scientific notation, the decimal number 3.14 × 10³ has:
    • Mantissa: 3.14 (the significant digits)
    • Exponent: 3 (which shifts the decimal point three places to the right)
  • Floating point binary works similarly but in base-2
  • Instead of multiplying by powers of 10, it multiplies by powers of 2 using a binary exponent

Representation of floating point

  • The appearance of floating-point binary is mostly the same except for the presence the decimal point

Binary representation of 7.875 as a floating point number, showing bit values for 16, 8, 4, 2, 1, 0.5, 0.25, and 0.125.

  • In the example above, an 8-bit number can represent a whole number and fractional elements
  • The point is always placed between the whole and fractional values
  • The consequence of floating point binary is a significantly reduced maximum value
  • The benefit of floating point binary is increased precision

Representation of negative floating point

  • Negative numbers can also be represented in floating point form using two’s Complement
  • The MSB is used to represent the negative offset of the number, and the bits that follow it are used to count upwards
  • The fractional values are then added to the whole number

Binary to decimal conversion, showing powers of two and fractional components resulting in the decimal value -9.875.

Converting Denary to Floating Point

Denary to floating point binary

Example: Convert 6.75 to floating point binary

Step 1: Represent the number in fixed point binary.

-8421.0.50.25
0110.11

Step 2: Move the decimal point.

| 0 | . | 1 | 1 | 0 | 1 | 1 |

Step 3: Calculate the exponent 

The decimal point has moved three places to the left and therefore has an exponent value of three

-421
011

Step 4: Calculate the final answer:

Mantissa: 011011

Exponent: 011

Converting Floating Point to Denary

Binary floating point to denary

Example: Convert this floating point number to denary:

  • Mantissa - 01100
  • Exponent - 011

**Step 1: **Write out the binary number. 

| 0 | . | 1 | 1 | 0 | 0 |

Step 2: Work out the exponent value.

The exponent value is 3. 

-421
011

Step 3: Move the decimal point three places to the right. 

-8421.0.5
0110.0

Step 4: Calculate the final answer: 6

Normalising Floating Point Binary

  • A floating point number is said to be normalised when it starts with 01 or 10

Why normalise?

  • Ensures a consistent format for floating point representation
  • Makes arithmetic and comparisons more straightforward

Steps to normalise a floating point number

  1. Shift the decimal point left or right until it starts with a 01 or 10
  2. Adjust the exponent value accordingly as you move the decimal point
    • Moving the point to the left increases the exponent and vice versa
  • Example
    • Before normalisation:
      • Mantissa = 0.0011
      • Exponent = 0010 (2)
    • After normalisation:
      • Mantissa = 0.1100
        • Decimal point has moved 2 places to right so it starts with 01
      • Exponent = 0000 (0)
        • Exponent has been reduced by 2

Decode a normalised floating point binary number

  • In A Level Computer Science, you may be given a floating point number made up of two parts:
    • A 4-bit mantissa (in two’s complement)
    • A 4-bit exponent (also in two’s complement)
  • For example:
    • 1101 1111
    • Mantissa = 1101
    • Exponent = 1111

Step 1: Convert the exponent to denary

  • The exponent is stored in 4-bit two’s complement, so:

    • If the first bit is 0 → it’s a positive number
    • If the first bit is 1 → it’s negative
  • Example:

Exponent: 1111 → two’s complement = -1

Step 2: Convert the mantissa to binary

  • The mantissa is also in 4-bit two’s complement

  • Convert it to a denary number.

  • Then convert it to a binary value, assuming the binary point goes just after the first bit (because it’s normalised)

  • Example:

Mantissa: 1101 → two’s complement = -3

Binary of 3 = 011

So -3 in normalised binary = -0.110 (we assume a leading 1 is implied)

Step 3: Shift the binary point

  • Now shift the binary point by the exponent value.

    • If exponent is positive, move the point to the right
    • If exponent is negative, move it to the left
  • Example:

Start with: -0.110

Exponent = -1

Shift the point 1 place left → -0.0110

Step 4: Convert to denary

  • Now convert the final binary number into denary

-0.0110 =

0 × ½ = 0

1 × ¼ = 0.25

1 × ⅛ = 0.125

0 × 1/16 = 0

Final value = -0.25 - 0.125 = -0.375

  • Answer: –0.375