Download presentation

Presentation is loading. Please wait.

Published byXavier Moser Modified over 2 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), = R = 2 binary (computers), = = 1100 R = 8 octal = 14 8 R = 10 decimal R = 16 hexadecimal = 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.: = = = , or = = 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: = = 35 8 = = 1D 16 or = = = =.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.: = = = 1D.5A 16

2
i = 2 n -1 * r n n -2 * r n-2 + … * r * r * r 0, integer f = 2 -1 * r * r -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: For fractions successive multiply by 2 and 14 1 LSB MSB Binary to Decimal and vice versa take integer, e.g.: x and read bits from the top, = MSB LSB 1 0

3
Negative Numbers (twos complement arithmetic) k = - 2 n * s + 2 n -1 * b n n -2 * b n-2 + … * b * b * b 0 Sign extension (padding by s) to the left does not change the value: e.g.: -4 = 1100 = = , +4 = 0100 = = 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 = = 10 i = = 10 + j = = j = = = = 6 Overflow: if carry into sign bit is different than carry out of sign bit. Examples: i = = -10 i = = 10 + j = = j = = carry10 carry01

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google