Design factors
Words and bits
Suppose
Simplicity of computation logic
Some representation formats require simpler and more efficient circuits for performing basic arithmetic operations than others. This is an important factor in choosing the representation format.
Special numbers
ONe may want to reserve space in representation set for storing special numbers like +Inf, -Inf, NaN (for storing results of illegal operations).
Integers
Suppose
Unsigned
Any
Signed
While storing negative numbers along with positive numbers, one has to distinguish it from positive numbers, one requires a sign bit.
Use sign bit + absolute value
A straightforward way to store
Offset/ biased storage
One can take a large natural number called
1’s complement storage
Suppose we use the bias
2’s complement bias
Here again, we used biased representation only to store -ve numbers, we store
If b=3, the numbers
Note that this representation of
Addition of -ve and +ve numbers (ie subtraction) becomes slightly easier: the circuit used to add two unsigned numbers will work fine.
IEEE floating point
Division of bits
The bits provided for storage are divided into the following components: 1 sign (
Number stored
This imitates scientific notation of numbers:
Note that rather than use a sign bit in the exponent, the biased representation is used.
As scientific notation is used, 1 in (1+f) assumed, so the number of bits needed is effectively reduced by 1 bit!
IEEE standards
\textbf{Single precision}: M= 23 bits, E = 8 bits.
\textbf{Double precision}: M= 52 bits, E = 11 bits.
Reserved numbers
0 := is stored as
NaN
Range
Allowing for the reserved numbers and considering the range of M and E bits, we can observe the range.
Smallest non 0:
So, underflow or overflow rare.
Increasing gaps in different ranges
In [1,2]:
Representation Accuracy
Let
Machine epsilon
In case of floating point representations, we can guarantee that
In case of a floating point number system with
Yet, note that
Error guarantee view!
Then, roundoff error [
Accuracy of arithmetic operations
IEEE ensures:
For complex numbers