Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
15 views

3 Computer Arithmetic

Computer Arithmetic

Uploaded by

Savinu Gamage
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

3 Computer Arithmetic

Computer Arithmetic

Uploaded by

Savinu Gamage
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

C O M P U T E R AR I T H M E T I C C H AP T E R 0 3

BINARY CALCULATIONS
BINARY ADDITION

A B A+B
0 0 0
0 1 1
1 0 1
1 1 10
“two”
ADDITION

1 1
10101 21
+ 11001 + 25
101110 46
SUBTRACTION

1 1
MULTIPLICATION

A B AB
0 0 0
0 1 0
1 0 0
1 1 1
MULTIPLICATION

1110
x 1011
1110
1110
0000
1110
10011010
011
DIVISION 10 110
0
11
10
10
10
0
INTEGER NUMBER REPRESENTATION
COMPUTER NUMBER CALCULATION

1. There is no special logic in computers to do subtraction. Instead,


there is special logic to negate an operand to the adder. Then A -
B just becomes A + (-B).
2. In computers, subtraction is generally carried out by addition.
REPRESENTING VALUES

1. We have 04 ways to represent values in computers

1. Un-Signed Magnitude
2. Signed Magnitude
3. 1’S Complement
4. 2’S Complement
UN-SIGNED MAGNITUDE
UN-SIGNED MAGNITUDE
UN-SIGNED MAGNITUDE : CALCULATION
UN-SIGNED MAGNITUDE : ISSUES

1. There is no available mechanism to represent negative values.

2. We can not perform 16 + (-16)


SIGNED MAGNITUDE
SIGNED MAGNITUDE
SIGNED MAGNITUDE : CALCULATION
SIGNED MAGNITUDE : ISSUES

1. Due to the 7-bit representation, there is limited space available to


represent numbers

2. When using this method for calculations, the answers often turn out
to be incorrect.

3. Having two placeholders for zeros resulted in unnecessary wastage.


1’S COMPLEMENT
1’S COMPLEMENT
1’S COMPLEMENT : CALCULATION
1’S COMPLEMENT : ISSUES

1. There are two notations for 0 (00000000 and 11111111) Having


two placeholders for zero resulted in unnecessary wastage.
2’S COMPLEMENT
2’S COMPLEMENT
2’S COMPLEMENT : CALCULATION
FLOATING POINT NUMBER REPRESENTATION
(IEEE754)
FLOATING POINT NUMBER
REPRESENTATION
Decimal Numbers Binary Numbers Exponent

10.05 → 1.005 x 101 1101.101 → 1.101101 x 23

25.5 → 2.55 x 101 11.11 → 1.111 x 21

0.005 → 5.0 x 10-3 0.00001 → 1.0 x 2-5

Exponent (+) Exponent (-)


FLOATING POINT NUMBER
REPRESENTATION
16.75 Floating Point Representation

STEP 01 : Number Normalizing Mantissa : 000011


Exponent : +4
16 Binary : 00010000
.75 Binary : 11
Mantissa Exponent
16.75 → 00010000.11

00010000.11 → 1.000011 x 24

1.000011 x 24
FLOATING POINT NUMBER
REPRESENTATION
STEP 02 : Exponent Calculation

Exponent : +4

IEEE754 Exponent : (+4) + 127 = 131

Binary 131 : 10000011

Add 127 to Exponent


FLOATING POINT NUMBER
REPRESENTATION

STEP 03 : Finalize the IEEE754 format (32 Bit)


16.75
Exponent : 10000011
Mantissa : 000011 (Fill remaining by 0)
THANK YOU

You might also like