number systems ron christensen cis 121. positional notation –“positional notation” value of a...
TRANSCRIPT
![Page 1: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/1.jpg)
Number Systems
Ron Christensen
CIS 121
![Page 2: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/2.jpg)
Positional Notation
– “Positional Notation”• Value of a digit depends on the position of the digit
– Positional Notation permits unique representation of Integers
![Page 3: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/3.jpg)
Positional Notation
– Decimal numbers are “Base 10 positional notation”
• Base 10 means that the value of any position is a multiple of a power of 10
– Binary numbers are “Base 2 Positional notation”
– Octal numbers are “Base 8 Positional notation”
– Hexadecimal numbers are “Base 16”
![Page 4: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/4.jpg)
4
Positional Notation
• The value of digit n is baseN
• N0 = 1 no matter what N is
• In decimal notation the value of digit N is 10N
– “19” = 1x101 + 9x100
![Page 5: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/5.jpg)
Base 10
• Base 10 uses ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
• This is called a decimal number system and is the one with which people are most familiar.
![Page 6: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/6.jpg)
Why Binary?
• Build Transistor
![Page 7: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/7.jpg)
Base 2
• Base 2 has exactly two symbols: 0 and 1.
• This is called a binary system and all numbers must be formed using these two symbols.
![Page 8: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/8.jpg)
Base 8
• Base 8 uses eight symbols: 0, 1, 2, 3, 4, 5, 6, and 7.
• This is called an octal number system and is a convenient shorthand for base 2 numbers.
• One octal digit is the equivalent of three binary digits.
![Page 9: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/9.jpg)
Base 16
• Base 16 uses sixteen symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.
• This system is called hexadecimal and can also serve as a shorthand for the binary number system.
![Page 10: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/10.jpg)
Converting Number Systems
• It is sometimes necessary or more convenient to convert numbers in one system to those in another.
![Page 11: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/11.jpg)
Converting Base 2(Binary) to Base 10 (Decimal)• In binary notation the value of digit N is 2N
– “1011” = 1x24 + 0x23 + 1x21 + 1x20 = 8+0+2+1 = 11
• What is the decimal value of 110110001?– 1x28 + 1x27 + 1x25 + 1x24 + 1x20
• = 256 + 128 + 32 + 16 + 1 = 433
![Page 12: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/12.jpg)
Converting Base 2to Base 8
• To convert base 2 to base 8, combine the binary digits from the right in groups of three and convert.
111101001011111101001011
111111 101101 001001 011011
77 55 11 33
![Page 13: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/13.jpg)
Converting Base 2to Base 16
• To convert base 2 to base 16, combine the binary digits from the right in groups of four and translate.
111101001011111101001011
11111111 01000100 10111011
FF 44 BB
![Page 14: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/14.jpg)
Converting Base 8to Base 2
• To convert base 8 to base 2, convert each octal digit into 3 binary digits.
111101001011111101001011
111111 101101 001001 011011
75137513
![Page 15: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/15.jpg)
Converting Base 8to Base 16
• To convert base 8 to base 16, first translate into base 2 then into base 16.
111111 101101 001001 011011
75137513
11111111 01000100 10111011
FF 44 BB
![Page 16: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/16.jpg)
Converting Base 10to Base 2
• To convert base 10 to base 2, divide the number repeatedly by 2; use remainders as answer.
On your own, try: 2363.On your own, try: 2363.
![Page 17: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/17.jpg)
Practice
• What is the binary value of 120?• First division is 120/2. Q=60, R=0• Second division is 60/2. Q=30, R=0• Third division is 30/2. Q=15, R=0, • Fourth division is 15/2. Q=7, R=1• Fifth division is 7/ 2. Q=3, R=1• Sixth division is 3/2. Q=1, R=1• Seventh division = 1 / 2. Q=0, R=1• Quotient is zero, so we stop.• 12010 = 11110002
2
120
![Page 18: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/18.jpg)
Converting Base 10to Base 8
• To convert base 10 to base 8, divide the number repeatedly by 8; use remainders as answer.
On your own, try: 2363.On your own, try: 2363.
![Page 19: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/19.jpg)
Converting Base 10 to Base 16
• To convert base 10 to base 16, divide the number repeatedly by 16; use remainders as answer.
On your own, try: 2363.On your own, try: 2363.
![Page 20: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/20.jpg)
Converting Base 16to Base 2
• To convert base 16 to base 2, translate each hexadecimal digit to 4 binary digits.
On your own, try: 4BC.On your own, try: 4BC.
![Page 21: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/21.jpg)
Converting Base 16to Base 8
• To convert base 16 to base 8, translate to base 2 then to base 8.
On your own, try: 4BC.On your own, try: 4BC.
![Page 22: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/22.jpg)
Converting Base 16to Base 10
• To convert base 16 to base 10, expand the number and translate base 16 digits to base 10.
On your own, try: 4BC.On your own, try: 4BC.
![Page 23: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/23.jpg)
Practice
• The number “123DF” in decimal is– 1x164 + 2x163 + 3x162 + 13x161 + 15x160
– 65536 + 8192 + 768 + 208 + 15 = 74719
2
120
![Page 24: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/24.jpg)
Number Systems
• Binary is used by hardware
• Hex numbers are used in many places– HTML color codes
• Decimal numbers appear in user interfaces
Conversions are done with calculators
![Page 25: Number Systems Ron Christensen CIS 121. Positional Notation –“Positional Notation” Value of a digit depends on the position of the digit –Positional Notation](https://reader035.vdocument.in/reader035/viewer/2022062409/56649ed15503460f94be0cfa/html5/thumbnails/25.jpg)
Binary Encoding – Data
• Binary numbers work well for positive integers
• Not all data is positive integer:– Negative integers– Real numbers, e.g. decimal points– Characters