Presentation is loading. Please wait.

Presentation is loading. Please wait.

Http://proglit.com/.

Similar presentations


Presentation on theme: "Http://proglit.com/."— Presentation transcript:

1

2 numbers

3 SA BY

4

5

6

7

8

9

10

11 1 bit (one of two states)

12

13 (a scheme for symbolically and verbally representing quantity)
number system (a scheme for symbolically and verbally representing quantity)

14 unary (the tally system)

15 Aiwt$e#&!)9?

16 positional notation (represents arbitrarily large quantities using a finite set of symbols)

17 (positional notation using 10 symbols)
decimal base-10 (positional notation using 10 symbols)

18 Arabic numerals

19 39 40

20 9 09

21 09 10

22 86999 87000

23 78 seventy-eight seven eight

24 Understand that a positional notation system can use any number of symbols as long as it uses at least 2. So you could have a base-3 system, or a base-17 system, or a base-1065 system, or whatever. The decision to use base-10 was really just an arbitrary historical decision, likely made because we have 10 fingers and 10 toes, so it seemed natural to people to use base-10. And in fact, some civilizations used other bases, like the ancient Babylonians used base-12, probably because it fit best with their calendar.

25 (positional notation using 8 symbols)
octal base-8 (positional notation using 8 symbols) So let's look at a positional notation system which uses something other than base-10. The base-8 system goes by the name octal.

26 Rather than contriving new symbols, we use the same Arabic numerals as we do in decimal; we just use 8 of them instead of all 10.

27 07 10 When you have the quantity seven and you wish to express one higher, the '7' cycles back to '0', and the digit to its left cycles to '1', so the quantity we call 'eight' in decimal is written as '1' '0' in octal. While it's very, very tempting to read '1' '0' as the quantity 'ten', it is rather, in octal, the same quantity which we write as '8' in decimal. (After a lifetime of habit, it's really hard to stop yourself from reflexively reading numerals as decimal numbers.)

28 octal base-8 decimal base-10 1 2 3 4 5 6 7 10 11 12 13 14 1 2 3 4 5 6
9 10 11 12 octal base-8 decimal base-10

29 octal base-8 decimal base-10 15 16 17 20 21 22 23 24 25 26 27 30 13 14
18 19 20 21 22 23 24 octal base-8 decimal base-10

30 317777 320000

31 61 (decimal) 061 (octal)

32 05673

33 (positional notation using 16 symbols)
hexadecimal hex base-16 (positional notation using 16 symbols)

34 8 9 A B C D E F

35 0F 10

36 hex base-16 decimal base-10 1 2 3 4 5 6 7 8 9 A B C 1 2 3 4 5 6 7 8 9
11 12 hex base-16 decimal base-10

37 hex base-16 decimal base-10 D E F 10 11 12 13 14 15 16 17 18 13 14 15
19 20 21 22 23 24 hex base-16 decimal base-10

38 hex base-16 decimal base-10 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26
27 28 29 30 31 32 33 34 35 36 hex base-16 decimal base-10

39 ADD BAD BEAD BEE BEEF CAFE DEAD DEAF DEED FAD FEED

40 0xADD 0xBAD 0xBEAD 0xBEE 0xBEEF 0xCAFE 0xDEAD 0xDEAF 0xDEED 0xFAD 0xFEED

41 0xA3BFFFFF 0xA3C00000

42 (positional notation using 2 symbols)
binary base-2 (positional notation using 2 symbols)

43 0 1

44 01 10

45 binary base-2 decimal base-10 1 10 11 100 101 110 111 1000 1001 1010
1011 1100 1 2 3 4 5 6 7 8 9 10 11 12 binary base-2 decimal base-10

46 binary base-2 decimal base-10 1101 1110 1111 10000 10001 10010 10011
10100 10101 10110 10111 11000 13 14 15 16 17 18 19 20 21 22 23 24 binary base-2 decimal base-10

47 101b (binary) 101 (decimal)

48 b b

49

50 base conversions

51 36259

52 (30000) + (6000) + (200) + (50) + (9)

53 (3 * 10000) + (6 * 1000) + (2 * 100) + (5 * 10) + (9 * 1)

54 (3 * 104) + (6 * 103) + (2 * 102) + (5 * 101) + (9 * 100)

55 36259 104 103 102 101 100 10000 1000 100 10 1

56 octal to decimal

57 03675

58 (03000) + (0600) + (070) + (05)

59 (03 * 01000) + (06 * 0100) + (07 * 010) + (05 * 01)

60 (03 * 0103) + (06 * 0102) + (07 * 0101) + (05 * 0100)

61 (3 * 83) + (6 * 82) + (7 * 81) + (5 * 80)

62 (3 * 512) + (6 * 64) + (7 * 8) + (5 * 1)

63 (1636) + (384) + (56) + (5)

64 03675 = 2081

65 decimal to octal

66 36256

67 (3 * 104) + (6 * 103) + (2 * 102) + (5 * 101) + (6 * 100)

68 (03 * 0124) + (06 * 0123) + (02 * 0122) + (05 * 0121) + (06 * 0120)

69 (03 * ) + (06 * 01750) + (02 * 0144) + (05 * 012) + (06 * 01)

70 (072460) + (013560) + (0310) + (062) + (06)

71 36256 =

72 hex to decimal

73 0x36E59

74 (0x3 * 164) + (0x6 * 163) + (0xE * 162) + (0x5 * 161) + (0x9 * 160)

75 (3 * 65536) + (6 * 4096) + (14 * 256) + (5 * 16) + (9 * 1)

76 (196608) + (24576) + (3584) + (80) + (9)

77 0x36E59 = 224857

78 binary to decimal

79 10101b

80 (1 * 24) + (0 * 23) + (1 * 22) + (0 * 21) + (1 * 20)

81 (1 * 16) + (0 * 8) + (1 * 4) + (0 * 2) + (1 * 1)

82 (16) + (0) + (4) + (1)

83 10101b = 21

84 b

85 b 128 32 8 4 1

86 (128) + (32) + (8) + (4) + (1)

87 b = 173

88

89 decimal to binary

90 find biggest fitting power of two
subtract it out repeat until left with 0

91 35872

92 35872 32768 (215)

93 1???????????????b

94 = 3104

95 3104 2048 (211)

96 10001???????????b

97 3104 – 2048 = 1056

98 1056 1024 (210)

99 100011??????????b

100 1056 – 1024 = 32

101 32 32 (25)

102 ?????b

103 32 – 32 =

104 b

105 why use hex and octal?

106 octal to binary (and vice versa)

107 octal base-8 binary base-2 1 2 3 4 5 6 7 000 001 010 011 100 101 110
1 2 3 4 5 6 7 000 001 010 011 100 101 110 111 octal base-8 binary base-2

108 03673

109 octal base-8 binary base-2 1 2 3 4 5 6 7 000 001 010 011 100 101 110
1 2 3 4 5 6 7 000 001 010 011 100 101 110 111 octal base-8 binary base-2

110 03673 b

111 b

112 b 01526

113 hex to binary (and vice versa)

114 hex base-16 binary base-2 1 2 3 4 5 6 7 8 9 A B C D E F 0000 0001 0010
1 2 3 4 5 6 7 8 9 A B C D E F 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 hex base-16 binary base-2

115 0x7E9 b

116 b 0x32D

117 recap Each digit is a coefficient of the number base raised to an increasing power. One technique works for all number base conversions. Shortcut conversions: decimal to binary (sum powers of 2) binary to decimal (subtract out powers of 2) octal and binary (1 octal digit = 3 binary digits) hex and binary (1 hex digit = 4 binary digits) Effectively, hex and octal serve as a compacter way of writing binary.

118

119 meaning relies upon agreement

120 integer (whole number) 5878 0 -87 234

121 signed integer unsigned integer

122 0, 1, 2, 3, 4, 5… 0b, 1b, 10b, 11b, 100b, 101b…

123 n bits = 2n values 1 bit = 2 values 2 bits = 4 values
etc…

124 unsigned value range 1 bit = 0..1 2 bits = 0..3 3 bits = 0..7
etc…

125 sign bit (positive three) (negative three)

126 one’s complement (positive three) (negative three)

127 two’s complement (positive three) (negative three)

128 two’s complement (negative three) (positive three)

129 00000101 (negative three in excess-8)
excess-n (positive three in excess-8) (negative three in excess-8)

130 00100111 (negative three in excess-42)
excess-n (positive three in excess-42) (negative three in excess-42)

131 one’s complement: -127 to +127 two’s complement: -128 to +127
8-bit range sign bit: -127 to +127 one’s complement: -127 to +127 two’s complement: -128 to +127

132 rational numbers 2/5 1/98 7/1 -61/1738

133 radix-point notation (ratio written as an integer component and a fractional component, separated by a radix point) 3/4 1/8 -7/1 138/20 0.75 0.125 -7.0 6.9

134 36.259

135 (30) + (6) + (0.2) + (0.05) + (0.009)

136 (3 * 101) + (6 * 100) + (2 * 10-1) + (5 * 10-2) + (9 * 10-3)

137 36.259 101 100 10-1 10-2 10-3 10 1 1/10 1/100 1/1000

138 81 80 8-1 8-2 8-3 8 1 1/8 1/64 1/512

139 10.111b 21 20 2-1 2-2 2-3 2 1 1/2 1/4 1/8

140 finite rational (rational with a fractional component which can be expressed with a finite number of digits) 3/4 -7/1 138/20 1/3 738/61 0.75 -7.0 6.9 0.33

141 a ratio with denominator 2a5b is finite in decimal a ratio with denominator 2a is finite in octal a ratio with denominator 2a is finite in hex a ratio with denominator 2a is finite in binary all ratios which are finite in binary are also finite in decimal some ratios which are finite in decimal are also finite in binary

142 rational as two integers
3/4 Numerator: Denominator: -7/13 Numerator: Denominator:

143 (the computing equivalent of radix-point notation)
fixed-point (the computing equivalent of radix-point notation) 57/8 b Integer: Fraction:

144 scientific notation engineering notation
= * 102 = * 10-3 = * 105

145 (the computing equivalent of scientific notation)
floating-point (the computing equivalent of scientific notation) 21/2 1010.1b 1.0101b * 23 Significand: Exponent:

146 6.75

147 6.75 110b + 0.?b

148 0.75 3/4

149 3/4 1/2 + 1/4

150 6.75 = 110.11b

151 110.11b = 1.1011b * 22

152 1.1011b * 22 Significand: 11011000 Exponent: 00000010

153 (an international standard)
IEEE floating-point (an international standard)

154


Download ppt "Http://proglit.com/."

Similar presentations


Ads by Google