1
Class Objectives
•Arithmetic operations
•Decimal & Alphanumeric codes
Arithmetic Operations:
Base r Numbers
•Arithmetic operations with numbers in Base rfollow same
rules as for decimal numbers
–use only rallowable digits…
•Arithmetic operations include:
–Addition
–Subtraction
–Multiplication
2
Binary Addition: Single Bit
with CarryGiven two binary digits (X,Y) and a carry in (Z), we get the
following sum (S) and carry (C):
Carry in (Z) of 0:
Carry in (Z) of 1:
Z 1 1 1 1
X 0 0 1 1
+ Y + 0 + 1 + 0 + 1
C S 0 1 1 0 1 0 1 1
Z 0 0 0 0
X 0 0 1 1
+ Y + 0 + 1 + 0 + 1
C S 0 0 0 1 0 1 1 0
3
•Extending this to multiple bit examples:
Augend:01100 10110
Addend: +10001 +10111
Sum :11101 101101
•Note:
–the default Carry-In to the least significant bit is 0
•verify results using decimal values…
Binary Addition: Multiple Bits
4
•Multiple bit subtraction example:
Minuend : 10110 10110
Subtrahend: -10010 -10011
Difference: 00100 00011
•Note:
–If Subtrahend > Minuend
•interchange and append a –ve sign to the result
Binary Subtraction: Multiple Bits
5