IEEE standard preferred bias to represent exponent in floating point number, we will discuss about this trying to figure out if it was better to use known 2’s complement representation or not.

## What is bias and 2’s complement

First 2’s complement is a way to represent signed numbers, All what you do when reading 2’s complement number is to consider the most left bit is negative. For example: 1010 = -1 * 2^3 + 1*2 = -6 and 0110 = 1*2^2+1*2^1 = 6

Bias is considering the number is result of adding known value (usually half of number can be represented by our bits. For example: 1010 = 2^3 + 2 - 7 = 3 and 0110 = 2^2 + 2 - 7 = -1## Range on numbers

Supposing we have 8 bits in exponent as in 32bit standard in IEEE, If we decided to use 2’s complement we have range between -128 and 127 but the bias has the range from -127 to 128

Almost the same range of numbers except one form is going farther is small numbers and the other in big numbers, Not a big deal.

## Why IEEE prefered bias?

Actually 2’s complement representation makes comparison harder, but why?

If you are going to compare two numbers in 2’s complement you may need to compare the MSB first to see if signs are not the same, then you have to compare the numbers only if the sign is the same, one situation (sign is negative) bigger number is actually smaller number and vice versa.

In bias situation you have to compare as you are treating 2 unsigned binary numbers, see? It is easier for the hardware implementation.
## 0 comments:

## Post a Comment