Download presentation

Presentation is loading. Please wait.

Published byXavier Moser Modified over 5 years ago

1
Numbering Systems i = R n -1 * r n-1 + R n -2 * r n-2 + ….. + R 2 * r 2 + R 1 * r 1 + R 0 * r 0, integer f = R -1 * r -1 + R -2 * r -2 + ….. + R -m * r -m, fraction 0 <= r i < R. R = 1 unary (Roman numerals), 12 10 = 111111111111 1 R = 2 binary (computers), 12 10 = 1100 2 = 1100 R = 8 octal 12 10 = 14 8 R = 10 decimal R = 16 hexadecimal 12 10 = C 16 (hex digits are: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) Number does not change a value by padding it with 0s to the left for integer or to the right for fraction, e.g.: 29 10 = 0029 10 = 11101 = 011101, or.3515625 10 =.0101101 =.010110100 If R i = R k then going from R to R i is by grouping k R digits, e.g. from binary to octal group bits by 3 (from the right for integer or from the left for fraction), or to hexadecimal group bits by 4: 29 10 = 011101 = 35 8 = 00011101 = 1D 16 or.3515625 10 =.010110100 =.264 8 =.01011010 =.5A 16. Since integer and fraction part are independent in any system, mixed number can be converted by converting integer and fraction separately and adding them back together, e.g.: 29.3515625 10 = 11101.0101101 = 35.264 8 = 1D.5A 16

2
i = 2 n -1 * r n-1 + 2 n -2 * r n-2 + ….. + 2 2 * r 2 + 2 1 * r 1 + 2 0 * r 0, integer f = 2 -1 * r -1 + 2 -2 * r -2 + ….. + 2 -m * r -m, fraction 0 <= r i < 2. Binary to decimal use the above formulas. Decimal to binary use the following: for integer successive division by 2 and taking the remainder until quotient = 0, e.g.: 29 :2 and write bits bottom up: 11101. For fractions successive multiply by 2 and 14 1 LSB 07 0 03 1 01 1 00 1 MSB Binary to Decimal and vice versa take integer, e.g.: x2 3515625 and read bits from the top,.3515625 10 = MSB 0 703125.0101101 1 40625 0 8125 1 625 1 25 0 5 LSB 1 0

3
Negative Numbers (twos complement arithmetic) k = - 2 n * s + 2 n -1 * b n-1 + 2 n -2 * b n-2 + ….. + 2 2 * b 2 + 2 1 * b 1 + 2 0 * b 0 Sign extension (padding by s) to the left does not change the value: e.g.: -4 = 1100 = 11100 = 11111100, +4 = 0100 = 00100 = 00000100. k c = (k complement) > 0 if s=1 the number is negative: if s=0 the number is positive: k > 0 Addition is regular if both s = 0 or s = 1. However, subtraction reduces to addition: i - k = i + (- 2 n + k c ) = - 2 n + (i + k c ) Examples: i = 01010 = 10 i = 01010 = 10 + j = 10010 = -14 + j = 11100 = - 4 11100 = - 4 00110 = 6 Overflow: if carry into sign bit is different than carry out of sign bit. Examples: i = 10110 = -10 i = 01010 = 10 + j = 10010 = -14 + j = 01110 = 14 01000 11000 carry10 carry01

Similar presentations

OK

Warm-up Answer the following: – Addition of integers 1) 3 + (-8) = 2) – 6 + 9 = 3) – 5 + (-4) = 4) 5 + (-3) 5) – 7 + 11 – Subtraction of integers 6) 7.

Warm-up Answer the following: – Addition of integers 1) 3 + (-8) = 2) – 6 + 9 = 3) – 5 + (-4) = 4) 5 + (-3) 5) – 7 + 11 – Subtraction of integers 6) 7.

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google