Login

Back 

Positive floating point numbers using one byte 

Positive binary floating-point number representation using one byte
We will now look at some examples of binary floating-point numbers. Remember three things:

    1. Both the mantissa and exponent are ALWAYS 2s complement numbers.
    2. The decimal point is there in the mantissa, but not actually represented using a bit.
    3. The decimal point ALWAYS goes between the first two left hand digits!

In our one byte, we will use 5 bits for the mantissa and 3 for the exponent.

Example 7. Convert this binary floating-point number into decimal: 01101010

    1. Write down the mantissa. It’s 01101
    2. Insert the decimal point between the first 2 digits. That gives us 0.1101
    3. This is a positive normalised number because the left-most 2 bits are 01.
    4. The exponent is 010
    5. This is positive because the left-most bit is a zero.
    6. The exponent equals the denary value +2.
    7. We must move the decimal point in the mantissa 2 places to the right. We go from 0.1101 to 011.01
    8. This is a fixed-point binary number. The digits on the left of the decimal point give us the whole number part whilst the digits on the right give us the fraction part. Removing redundant zeros, we get 11.01
    9. Converting this fixed-point binary number into a denary number gives us 3.25

Example 8. Convert this binary floating-point number into decimal: 01010101

    1. Write down the mantissa. It’s 01010
    2. Inserting the decimal point gives us a mantissa of 0.1010
    3. We know it’s a positive normalised number because the two digits on the left are 01
    4. The exponent is 101
    5. This is a negative number because the left hand digit is a one.
    6. Converting this 2s complement number into a negative binary number gives us -(011) or -3 in denary. 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 point in the mantissa now needs to be moved three places to the left. (Move left because the exponent is negative.)
    7. The mantissa goes from 0.1010 to 0.0001010
    8. Removing redundant zeros gives us 0.000101
    9. Converting this number gives us 1/16 + 1/64, or 0.078125

A note on dropping zeros
Think of the denary number 248.65 If you put it into a calculator as 000248.65000, the unnecessary zeros would be dropped. That means that the zeros in front of the left-most non-zero digit on the left of the decimal point would go. In the above example, the 000248 would become 248. It also means that any zeros after the last non-zero digit on the right of the decimal place would go. In the above example, the .65000 would become .65

    • The number 034 is exactly the same as 34
    • The number 0004563 is exactly the same as 4563
    • 0.500000 is the same as 0.5
    • -0.00600 is the same as -0.006
    • 000248.65000 is exactly the same as 248.65
    • -0038.98000 is the same as -38.98

It is the same in binary.

    • -(0110011.100) is the same as -(110011.1)
    • 0001.1000 is the same as 1.1
    • 1000110.000010000 is the same as 1000110.00001
    • 001.0000100 is the same as 1.00001
    • -(001.0100) is the same as -(1.01)

z8 z9

Converting denary numbers into normalised binary floating-point numbers is simply a reverse of what we have just been doing.

Example 9. Convert 5.5 into a normalised floating-point number using our 2s complement system, with 5 places for the mantissa and 3 for the exponent.

    1. Convert 5.5 into a fixed-point number. You get 101.1
    2. This is a positive number. It must begin with 0.1 so we must move the decimal point to the left until we get 0.1
    3. Using 5 places for the mantissa, we now have 0.1011 (NOTE: If you now had a mantissa that was not five digits long, simply add extra zeros to the end of the number!)
    4. How many places would you need to move the decimal point to get back to 101.1? The answer is 3 places to the right! So the exponent, using 3 digits, is 011
    5. Putting mantissa and exponent together, the answer is 01011011


Example 10. Convert 3.5 into a normalised floating-point number using our 2s complement system, with 5 places for the mantissa and 3 for the exponent.

    1. Convert 3.5 into a fixed-point number. You get 11.1
    2. This is a positive number. It must begin with 0.1 so we must move the decimal point to the left until we get 0.1
    3. Using 5 places for the mantissa, we now have 0.111 There are only four digits here and our mantissa needs 5! Add a zero to the end of the number to give 0.1110
    4. How many places would you need to move the decimal point to get back to 11.1? The answer is 2 places to the right! So the exponent, using 3 digits, is 010
    5. Putting mantissa and exponent together, the answer is 01110010

z10

Back