Login

Back 

Largest and smallest numbers

Using a number line
When we discuss bigger and smaller numbers which can be negative or positive, it is useful to refer to a number line to help us avoid confusion about exactly what we are talking about.

z30

    • As positive numbers get bigger, the number gets bigger. The smallest positive number is the one that is closest to zero but still positive.
    • As negative numbers get bigger, the number actually gets smaller (further away from zero). The smallest negative number is the number that is closest to zero but still negative.

The largest and smallest values
Imagine you have a byte used to hold a floating-point number. In our byte, we will allow 5 bits for the mantissa and 3 bits for the exponent. Remember, both the mantissa and the exponent are always held as 2’s complement numbers.

The largest positive number

    • The largest number that can be held in our byte is when both the mantissa and the exponent are the largest positive numbers that can be held.
    • The largest mantissa that can be held is 01111. (Note that you must assume the mantissa is normalised, and so positive numbers always begin with 01).
    • The largest exponent that can be held is 011. (Remember, this is a 2s complement number so the left most bit is negative, and in this case represents -4).The largest number that can be held is 0.1111 x 2011
    • This is the same as 111.1, or 7.5 in decimal.

The smallest positive number

    • The smallest positive number that can be held is when the mantissa is the smallest positive number and the exponent is the largest negative number.
    • The smallest positive (normalised) mantissa is 01000.
    • The largest negative exponent is 100
    • The smallest positive number that can be held is therefore 0.1000 x 2100
    • This is the same as 0.00001, or 1/32, or 0.03125

The largest negative number (or the smallest number, depending on how you view it!!)

    • The largest negative number that can be held (the negative number that is furthest from zero) is when the mantissa is the biggest number negative number that can be held and the exponent is the largest positive number possible.
    • The biggest negative number you can hold in the mantissa is 10000 (Remember that all negative numbers must begin with 10).
    • The biggest positive number the exponent can hold is 011.
    • The largest negative number is therefore 1.0000 x 2011
    • This is the same as -(1.0000) x 23 or -1000, or -8.

The smallest negative number (or the biggest negative number, depending on how you view it!!)

    • The smallest negative number that can be held (the negative number that is closest to zero) is when the mantissa holds the smallest negative number and the exponent holds the largest negative number.
    • The smallest normalised negative number the mantissa can hold is 10111 (Remember that the mantissa must begin with 10 for normalised negative numbers).
    • The largest negative number the exponent can hold is 100.
    • The smallest negative number that this byte can hold therefore is 1.0111 x 2100
    • This is the same as -0.1001 x 2-4 or -0.00001001, or -0.03515625

To summarise
You have a fixed number of bits. You have to decide how many bits to use for the mantissa and the exponent.

    • The more bits you allow for the exponent, the greater the range of numbers you can represent - the down side being that the accuracy of the mantissa is reduced.
    • The fewer bits you allow for the exponent, the smaller the range of numbers you can represent, but the good news is you have more bits available for the mantissa - so the number you put in it can be more accurate.

How do you decide? You have to look at each situation and decide what range of numbers you need to keep and to what degree of accuracy!

z22 

Back