Computer Arithmetic
Computer Arithmetic
Number Representation
• Unsigned Integer Number:
– Range is 0 to (2n-1)
• Signed Integer Number:
– 1’s complement: Range is -(2n-1-1) to +(2n-1-1)
– 2’s complement: Range is -2n-1 to +(2n-1-1)
Sub using Add(1’s complement)
Multiplicati
on of 2 n
bit numbers
results in
max 2n bit
result
It requires
n additions
and n shift
operations
Booth’s algorithm for signed multiplication
-1 * M= 2’s complement
-2 * M= left shift -1 * M
Integer Division
Procedure for integer division
Floating Point Numbers
B= bn-1bn-2……b1b0.b-1b-2……b-m
These are called Fixed point numbers, as the radix point is fixed.
Limitations of this representation
Floating point number representation
IEEE 754
Normalized representation
Example
Another example
Floating Point Addition
Floating Point Subtraction