Real numbers in binary have to be stored in a special way in a computer. There is no decimal point in the binary system so the computer has a method of understanding decimals. This is called floating-point representation.
The decimal point in a real number is called a floating point because it can be placed anywhere - it is not fixed. Because of this, a computer will divide a number into two parts. These are called the mantissa and the exponent.
Mantissa[change | change source]
The mantissa is found by taking the real number and removing the decimal point, for example:
1101 . 0111 would become 1101 0111
Exponent[change | change source]
The exponent is the number of spaces the decimal point has moved. In the example above, the decimal point moved 4 places to the left, so the exponent is 0000 0100 (this is binary for 4).
If the decimal point moves to right, the exponent is negative. For example,
0000 . 0111 (mantissa - 0000 0111)
here, the exponent is -1. The binary number for this is 1111 1111 (see Negative binary numbers)
Result[change | change source]
The result is found by putting the Mantissa and Exponent together. The results for the examples above are:
|1101 . 0111||1101 0111||0000 0100||1101 0111 1111 0111|
|0000 . 0111||0000 0111||1111 1111||0000 0111 1111 1111|