Back 

Positive floating point numbers using two bytes

Positive binary floating-point number representation using two bytes
So far, we have just considered one byte to illustrate our binary systems. One byte limits us when we need to represent real numbers. We cannot represent a wide range of numbers and we cannot represent numbers with lots of decimal places (accuracy). It’s not very common to use one byte. It is more normal to use two, four or eight bytes to represent a real number. (By convention, odd numbers of bytes are not usually used). We will now use two bytes. Remember, both the mantissa and the exponent will always be in two's complement form. This will allow us to represent both positive and negative numbers!

We will agree to have 10 bits for the mantissa. (If the left-hand bit is a 'one', then the mantissa is negative in two's complement form. If it is a 'zero' then the number is a positive 2s complement number). The remaining 6 bits will be used for the exponent. This will also be a two's complement number. (If the left-hand bit of the exponent is a 'one', the exponent is a negative 2s complement number. If it's a zero, it's a positive 2s complement number). There is absolutely no difference in the way you convert 16 bit floating-point numbers (or any other number of bits) compared to 8 bit numbers. Also, remember that the decimal point is present in the mantissa - it is there, but not part of the information given to us in the byte.

Example 11. Convert this binary number into decimal: 0110 1000 0000 0011

    1. The mantissa is 0110100000
    2. We insert the decimal point in the correct place. It begins with 01, therefore it is a normalised positive number. Now we know automatically where to put the decimal place. We get 0.110100000
    3. The exponent is 000011 This is a positive number because the left hand bit is a zero. It is equivalent to the denary number 3. We need to move the decimal place in the mantissa 3 places to the right.
    4. The mantissa 0.110100000 now becomes 110.100000
    5. Dropping unnecessary zeros, we have 110.1
    6. This is a fixed-point decimal number. The 110 before the decimal point represents 6. The .1 represents a half.
    7. The final answer is 6.5

Example 12. Convert this binary number into decimal : 0100 0000 0011 1110

    1. The mantissa is positive because the first bit is zero.
    2. The mantissa is written down as 0.100000000
    3. The exponent is 111110. This is a negative number because the left most bit is a one. Converting 111110 into a negative number that is not in 2s complement form gives us -(000010) or -2. If you are not sure about this step, refer back to the examples given in the section ‘Getting back to a negative denary number’. The decimal place in the mantissa therefore needs to be moved 2 places to the left.
    4. The mantissa 0.100000000 now becomes 0.00100000000
    5. Dropping the redundant zeros, we have 0.001
    6. In fixed-point notation, this represents 1/8, or 0.125

z11 

z12

As before, converting denary numbers into normalised binary floating-point numbers is simply a reverse of what we have just been doing!

Example 13. Convert 14.75 into a normalised floating-point number using our two-byte system, with 10 places for the mantissa and 6 for the exponent.

    1. Convert 14.75 into a fixed-point number. You get 1110.11
    2. This is a positive number. It must begin with 0.1 and we can add any extra zeros to the end of the number to make up our 10 places.
    3. Using 10 places for the mantissa, we have 0.111011000
    4. How many places would you need to move the decimal point to get back to 1110.11? 4 to the right! So the exponent, using 6 digits for the exponent, is 000100
    5. Putting mantissa and exponent together, the answer is 0111 0110 0000 0100

Example 14. Convert 2.25 into a normalised floating-point number using our two-byte system, with 10 places for the mantissa and 6 for the exponent.

    1. Convert 2.25 into a fixed-point number. You get 10.01
    2. This is a positive number. It must begin with 0.1 and we can add any extra zeros to make up our 10 places.
    3. Using 10 places for the mantissa, we now have 0.100100000
    4. How many places would you need to move the decimal point so that you get back to 10.01? 2 to the right! So the exponent, using 6 digits for the exponent, is 000010
    5. Putting mantissa and exponent together, the answer is 0100 1000 0000 0010

Example 15. Convert 101/8 into a normalised floating-point number using our two-byte system, with 10 places for the mantissa and 6 for the exponent.

    1. 101/8 is the same as 10.125
    2. Convert 10.125 into a fixed-point number. You get 1010.001
    3. This is a positive number. It must begin with 0.1 We can add any extra zeros to make up our 10 places.
    4. Using 10 places for the mantissa, we now have 0.101000100
    5. Now how many places do you need to move the decimal point to get back to 1010.001? 4 to the right! So the exponent, using 6 digits for the exponent, is 000100
    6. Putting mantissa and exponent together, the answer is 0101 0001 0000 0100

z13

Back