Floating point numbers introduction

Floating-point numbers
So far, and staying with our byte, we know that in two's complement form, we can represent integers (whole numbers) from +127 to -128. We can't represent real numbers using this system. We can represent real numbers using fixed-point representation but it is only useful if the data is predictable and within a certain range. What we need is to be able to represent a wide range of real numbers. Switching to decimal for a moment, you can represent these real decimal numbers in a different way. Look at these examples.

    • 325.5 can be represented as 0.3255 x 103
    • 1050.23 can be represented as 0.1050 x 104
    • 478934.52 can be represented as 0.47893452 x 106
    • 0.005 can be represented as 0.5 x 10-2
    • 0.000421 can be represent as 0.421 x 10-3

So you can have a number like 5000.23 and represent it as 0.500023 x 104. The way of representing numbers in different forms involves moving (or ‘floating’) the decimal point to a new position. The number part e.g. 0.500023 in the above example is called the ‘mantissa’. The number above the 10, the 4 in this case, is called the ‘exponent’.