Floating point
Score 0 / 0
Streak 0
Best 0
Write as normalised floating point
Type a number, such as -5.25 or 3/16.
Show the working
Press Enter for the next question
How floating point works
A floating point number has a mantissa and an exponent, both in two's complement. The binary point sits just after the first bit of the mantissa, so the mantissa's place values are −1, ½, ¼, ⅛ and so on. The exponent says how many places to move the binary point: right if it is positive, left if it is negative.
Normalised: the mantissa must start 01 (positive) or 10 (negative). This gives the most precision for the number of bits.
Floating point to denary:
- Work out the exponent in denary.
- Move the binary point that many places. Moving left, fill the gap with copies of the sign bit.
- Add up the place values of the 1s. The first bit is negative.
Denary to floating point:
- Write the number in fixed point binary. For a negative number, write the positive version, then flip the bits and add 1.
- Move the binary point to just after the first bit, where the first two bits are different. The number of places it moved left is the exponent (moving right gives a negative exponent).
- Pad the mantissa with 0s on the right, and write the exponent in two's complement.
Normalising: shift the mantissa left until the first two bits are different, filling with 0s on the right. Subtract the number of places shifted from the exponent.