Letting the binary point "float" back and forth as needed - floating point number system.
Floating point can be used to represent a wider range of real numbers in a limited number of bits, compared to the fixed point approach.
Floating point is similar to representing a number in scientific notation :-
-1.3425 X 10^3
Mantissa Exponent
'Mantissa' holds the number value and its sign. 'Exponent' defines where the decimal point needs to be if the number is shown in standard format. In the above case, 10^3 indicates that it needs to be multiplied by a thousand so the radix point has to move three places to the right, like this :
-1342.5
A binary floating point number is in two parts. The Mantissa and the Exponent. Here is an 8 bit floating point number
1.001 0010
Mantissa Exponent
The mantissa and the exponent are treated as separate numbers in two's complement. Each uses the leftmost digit (MSB) to express whether they're positive or negative.
If there is a 1 present in the MSB of the mantissa = negative number. If there is a 1 in the MSB in the exponent = negative exponent.
Mantissa
-1 . 1/2 1/4 1/8
1 . 0 0 1
Exponent
-8 4 2 1
0 0 1 0
In the mantissa there is one bit for the integer part and three bits for the fractional part. As there is a 1 in the leftmost digit, it is a negative number.
Mantissa
-1 . 1/2 1/4 1/8
1 . 0 0 1
Exponent
-8 4 2 1
0 0 1 0
To get this binary number into its full form, the exponent is indicating where the binary point needs to go to. Exponent is +2, shift the point two to the right. like this 100.1
If we place it in a binary table, its value looks like this :
-4 2 1 . 1/2
1 0 0 . 1
The value of this number is: -4 + 0 + 0 + 1/2 = -3 1/2 or -3.5
If this was stored in an 8 bit register it would be 1111 1001 where extra ones to the left pad it out to 8 bits as it is a negative number. If the number was positive, the extra bits would be padded out with zeroes.