Negative floating point numbers using two bytes

Negative binary floating-point number representation using two bytes
Two bytes will allow us to represent numbers with a greater range and accuracy than one byte. The more bits you can use for the mantissa, the greater the accuracy of the number. The more bits you can use for the exponent, the greater the range of numbers you can represent. When you have a fixed number of bits to use (e.g. one byte or two bytes) you have to balance how much accuracy you need with what range of numbers you want to represent.

Example 20. Convert 1001 1001 0000 0110 (10 bits for the mantissa and 6 for the exponent) into decimal.

    1. The mantissa is negative because the left most bit is a 'one'. Therefore the mantissa is in two's complement form!
    2. Write down the mantissa, 1.001100100. This is a two's complement number. It will need to be changed back into the binary system we are used to dealing with.
    3. Convert the two's complement number: 1.001100100 into a negative binary number that is not in 2s complement form. 1.001100100 becomes -(0.110011100) If you are having trouble with this step, refer back to the ‘Getting back to a negative denary number’ section. You simply start at the right most bit, copy all the bits up to and including the first ‘1’, and then invert the remaining bits. It doesn’t make any difference that there is a decimal point there!
    4. The exponent is 000110 This is +6 in decimal. We must move the decimal place 6 places to the right.
    5. -(0.110011100) now becomes -(0110011.100) Dropping redundant zeros, we get -(110011.1)
    6. Converting this to denary gives -(32+16+0+0+2+1+0.5) = -51.5

Example 21. Convert 1000 1100 0011 1100 (10 bits for the mantissa and 6 for the exponent) into decimal.

    1. The mantissa is a normalised negative number because the first bits of the mantissa are 10
    2. Write down the mantissa and convert from a 2s complement number into a negative pure binary number. 1.000110000 becomes -(0.111010000)
    3. The exponent is 111100. This is always in two's complement form and is negative because the left most digit is a one. Converting it, 111100 becomes -(000100), which is -4.
    4. Moving the decimal place in the mantissa 4 places left, -(0.111010000) becomes -(0.0000111010000)
    5. Removing unnecessary zeros gives us -(0.000011101)
    6. Converting, this gives -(1/32 + 1/64 + 1/128 + 1/512) The final answer is therefore -0.056640625


Please register to read more ......