Floating point representation
Real decimal numbers
Standard form is a way of writing numbers. It can be used to represent large numbers that include decimal values (this is also often called scientific notation).
When using standard form, you could write the number 34.567 as:
102 is the same as 10x10, which equals 100. Multiplying 0.34567 by 100 gives the original value of 34.567.
The decimal point has moved 2 places to the left to create a Mantissa.
Multiplying by 102 would shift the decimal point two places to the right and recreate the original value. In this example, the value 2 is referred to as the exponent.
Computers use something similar called floating point representation. However, computer systems can only understand binary values. This means that the Mantissa and Exponent must be represented in binary.
Similarly, instead of multiplying to the power of ten, computers would multiply to the power of two. This is because computers do not use a ten-state system (0,1,2,3,4,5,6,7,8,9) but a two-state system (0,1).
Floating point example
Floating point theory is very complex. The following example is used to offer a lead into the complex theory behind floating point representation. There are additional steps that are not relevant at this level of study.
The number 18.5 can be converted to binary to give us:
10010.1
16 + 2 + 0.5 = 18.5
Two's Complement is the way most computers store positive and negative integers. In Two's Complement the computer uses the most significant bit (MSB) to determine whether a number is positive (represented by a 0) or negative (represented by a 1). The MSB is always the bit on the very left of the number. In this system 18.5 is written as:
010010.1
This is because when we convert 18.5 from denary to binary we get:
There is a 0 underneath the value 32 because we want to represent the positive value 18.5, so the MSB needs to be 0.
To store this as a floating-point number, we need to move the decimal point so that it appears after the most significant bit (MSB). The MSB is the bit on the left of the number. In this case we move the decimal point five places, so our number becomes:
0.100101 x 25
But we also need to store the value 5 (seen as 25 ) as a binary number, so it would become:
0.100101 x 20101
The 20101 (2 to the power of 5) tells us that we need to move the decimal point five places to the right to recreate the original value.
The system will not store the actual decimal place, it is shown to aid understanding. In this case the number is stored as follows:
| Mantissa | Exponent |
| 100101 | 0101 |
| Mantissa | 100101 |
|---|---|
| Exponent | 0101 |
At this level, you need to know that:
- A floating-point number is made of two parts called the Mantissa and Exponent
- The mantissa dictates the precision of a number, the more bits allocated to the mantissa, the more precise a number can be
- If you want to be store a large range of numbers then you need to allocate more bits to the storage of the exponent, as the exponent dictates the range of numbers that can be represented
Remember, there are more steps involved in the actual storage of floating point values but the level of complexity is beyond that of the requirements of this course.