Download presentation
Presentation is loading. Please wait.
1
Representing numbers in different bases N = a n-1 * r n-1 + a n-2 * r n-2 + … + a 0 + a -1 *r -1 + a -2 *r -2 + … D = a n-1 a n-2 … a 0. a -1 a -2 … In base r In base 10:
2
Representing numbers in different bases Convert: (0.41) 10 to () 4
3
Representing numbers in different bases 0.41 = a n-1 * 4 n-1 + a n-2 * 4 n-2 + … + a 0 + a -1 *4 -1 + a -2 * 4 -2 + … =0 0.41 = a -1 *4 -1 + a -2 * 4 -2 + …
4
Representing numbers in different bases 0.41 = a -1 *4 -1 + a -2 * 4 -2 + … 4 1.64 = a -1 + a -2 * 4 -1 + a -3 * 4 -2 <1 a -1 = 1
5
Complement to Base r Definition: xxxxxxxx. yyyyyy Number r-complement n digitsm digits Dr n - D (1101) 2 (12) 10 2-complement 10000-1101 =0011 10-complement 100-12 = 88 n=42424 n=2 10 2
6
Complement-1 to Base r Definition: xxxxxxxx. yyyyyy Number (r-1) complement n digitsm digits Dr n -r -m - D (1101.11) 2 (12) 10 1-complement 1111.11-1101.11 =0010.00 9-complement 99-12 = 87 n=3 m=2 n=1
7
Another representation of 2 complement a n-1 a n-2 … a 0. a -1 a -2 … BCD Weight: 2 n-1 2-complement Weight: -2 n-1 BCD Coding 1101 = Two complement -2 3 + 2 2 + 1 0011- -3
8
Calculating the r complement r n -r -m - D r n - D (r-1) complement r complement +r -m Number (base 2): 1101 1-complement:0010 +1 0011
9
0 in complement to 1 00000 11111 Number 1-complement Two representations to 0!
10
Complement to 1 vs. 2 1-Complement2-Complement Calculation EasyHarder Zero preserntation DualSinge We usually use 2-complement
11
Subtraction using 1-complement M – N M + 2 n -N-1 = 2 n +(M-N-1) M>N-1M<N-1 2 n +(M-N-1) >0 Carry exists Add it to the result (M-N) Carry 2 n +(M-N-1) No Carry Take the complement and put (-) <0 2 n – (2 n +(M-N-1)) -1 -[ -(N-M) ]
12
Example I 3 -5 0011 +1010 101 No Carry -010 = -2
13
Example II 3 -2 011 +101 000 1 001 Carry 1
14
Changing number of bits Given a number in 2 complement with n bits What is the representation with m>n bits ?
15
Changing number of bits 00111011 00 0011 11 1011
16
Binary Multiplication 1101 X 0011 1101 100111 13 X 03 39
17
2-Complement multiplication -3 5 X 1101 0101 X 111101 00000 1101 110001 Carry 1
18
2-Complement multiplication -3 -5 X 1101 1011 X ?????
19
2-Complement multiplication -3 -5 X 1101 1011 X 1111101 111101 00000 0011 Remember: Last digit has negative weight 0001111 =15
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.