2021 22 3a

Computer Organization and Architecture2021-2210 marksNumericalFloating point arithmetic operation

A binary floating-point number has seven bits for a biased exponent. The constant used for the bias is 64. I. List the biased representation of all exponents from -64 to +63. II. Show that after addition of two biased exponents, it is necessary to subtract 64 in order to have a biased exponent's sum

A binary floating-point number has seven bits for a biased exponent. The constant used for the bias is 64. I. List the biased representation of all exponents from -64 to +63. II. Show that after addition of two biased exponents, it is necessary to subtract 64 in order to have a biased exponent's sum. III. Show that after subtraction of two biased exponents, it is necessary to add 64 in order to have a biased exponent's difference.

(I) Biased representation of exponents

A 7-bit exponent field holds $2^7 = 128$ values, from 0 to 127. With bias 64, the stored value is the true exponent plus 64:

$$E = e + 64$$

The true exponents $-64$ to $+63$ are therefore stored as 0 to 127. The list runs in order, so each exponent has the 7-bit binary form of $e + 64$. Some key values:

True exponent $e$Biased $E$7-bit pattern
$-64$00000000
$-63$10000001
$-2$620111110
$-1$630111111
$0$641000000
$+1$651000001
$+62$1261111110
$+63$1271111111

All the other exponents follow the same rule. Negative exponents begin with 0 and non-negative exponents begin with 1.

(II) Addition of exponents

Let the two true exponents be $e_1$ and $e_2$. Their biased forms are $E_1 = e_1 + 64$ and $E_2 = e_2 + 64$. Adding the stored values gives:

$$E_1 + E_2 = e_1 + e_2 + 128$$

The correct biased sum of the exponents must be $(e_1 + e_2) + 64$. The result above is 64 too large. So we subtract 64:

$$E_1 + E_2 - 64 = e_1 + e_2 + 64$$

This is the biased form of $e_1 + e_2$. This is the exponent step in floating point multiplication.

(III) Subtraction of exponents

Subtracting the stored values gives:

$$E_1 - E_2 = (e_1 + 64) - (e_2 + 64) = e_1 - e_2$$

The bias has cancelled out. But the biased form of $e_1 - e_2$ must be $(e_1 - e_2) + 64$. The result is 64 too small, so we add 64:

$$E_1 - E_2 + 64 = (e_1 - e_2) + 64$$

This is the exponent step in floating point division.

Check with numbers. Take $e_1 = 5$ and $e_2 = -3$. Then $E_1 = 69$ and $E_2 = 61$. The sum is $69 + 61 - 64 = 66 = 2 + 64$, which is the biased form of $5 + (-3) = 2$. The difference is $69 - 61 + 64 = 72 = 8 + 64$, which is the biased form of $5 - (-3) = 8$. Both agree. The result is valid only if the true result stays between $-64$ and $+63$. Otherwise there is exponent overflow or underflow.

This is why a biased exponent is useful. All stored exponents are plain positive numbers, so the sign of the exponent never needs special handling. The only extra work is the single correction of 64 after each addition or subtraction, which is a cheap operation for the hardware.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.

Up nextShow the multiplication process using Booth algorithm, when the following binary numbers,