In representing real numbers, computers are programmed to use Floating Point Representation. In floating point represnetation, the real number is stored as two seperate pieces of data, called the mantissa and exponent.
The mantissa holds the complete number without the point.
The exponent holds the amount of places the point needs to be moved to the left hand side to keep the original number.
What is the mantissa and exponent of 011010.01?
The mantissa would be: 01101001
The exponent would be: 6 (0110) as the decimal point needs to be moved 6 places until it gets to the far left-hand side.
=> 01101001 x2^0110
although it is not necessary to store the base 2 or the”x” sign as they will always be involved.
Accuracy in real numbers.
If the mantissa is onlt storing 8 bits for the whole number and the number is nore than 8 then some of the numbers after the point will have to be discarded, therefore the accuracy of the number will be decreased
Ifthe binary number is: 0110100.1001
it will have to be reduced to 0110100.1 as the mantissa can only hold 8 bits, decreasing the accuracy.
Increasing the range of the mantissa and exponent allows the number to have more accuracy and a larger range of numbers which it could be.
Representing Negative Numbers.
There are two ways to represent negative numbers. a theoretical way is called signed bit represtentation. This is when the computer would take the leftmost bit of the number and assign a positive or negative sign but this is not used as there is two values for zero. So two’s compliment represetation is used.
When using twos compliment, all the zeros in the binary number must be changed to a one and all the ones must be changed to a zero. Then a one is added on.
What is negative 5?
firstly what is 5 in binary? 0101-> 1010
= 1011 -> negative 5