Download presentation
Presentation is loading. Please wait.
Published byOphelia Pearl Osborne Modified over 6 years ago
1
Lecture 3: Binary values and number systems
Information Layer Lecture 3: Binary values and number systems
2
Layers of Computing Systems
Communications Applications Operating Systems Programming Hardware Information
3
Information Information Layer 01001010101010 numbers audio text Images
video
4
Binary values and number systems
Numbers and Computing Positional notation Binary, Octal and Hexadecimal Arithmetic in other bases Power of 2 Number Systems Converting from base 10 to other bases Binary values and computers
5
Numbers and Computing Computer executes numeric computations
All types of information that is stored on a computer is stored as numbers (0s and 1s) Number – unit belonging to an abstract mathematical system and is a subject to specified laws of succession, addition and multiplication
6
Positional notation How many ones are there in 943?
The answer depends on base Base of a number system specifies the number of digits used in the system. Digits always begin with 0 and continue through one less than the base Eg. Base 10: has digits from 0 to 9
7
Base 10 (decimal) Base 2 (binary) Base 8 (octal) Base 16 (hexadecimal) 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 9 1001 1010 12 A 1011 13 B 1100 14 C 1101 15 D 1110 16 E 1111 17 F 11000 20
8
Positional notation The rightmost digit represents its value multiplied by the base to the zeroth power, the digit to the left represents its value multiplied by the base to the first power Number 943 demystified: 9 4 3 9*102 4*101 3*10 0 900 40 943
9
9*x2+4*x1+3*x0 Formal notation If a number in the base R number system has n digits, it is represented as follows, where di represents the digit in the ith position in the number dn*Rn-1+dn-1*Rn d2*R+d1
10
dn*Rn-1+dn-1*Rn-2+...+d2*R+d1
Decompose number 2458 using the formula above You can also use 9 4 3 9*102 4*101 3*10 0 900 40 943
11
Why? Why would you need to represent values in base 2? 8? 13? 45???
12
binary to decimal To convert a number from binary to base 10, just break the number into a sum of numbers from the above list. Example: Convert to base 10 = = = 1910 = 16 + 102 = 2 12 = 1 1910
13
Decimal to other bases While (the quotient is not zero)
Divide the decimal number by the new base Make the remainder the next digit to the left of the answer Replace the decimal number with the quotient
14
Decimal to other bases Remainder C B A - ABC
15
Binary to octal To convert from binary to octal, you start at the rightmost binary digit and mark the digits in groups of threes. Then you convert each group of three to its octal value. E.g
16
Binary to hexadecimal mark digits from right to left in groups of four.
17
Arithmetic in other bases
Basic addition in decimal (base 10) 0+1=1 1+1=2 2+1=3 9+1=10 Because there is no symbol for 10, we reuse same digits and rely on position. The rightmost digit reverts to 0 and there is a carry into next position to the left
18
Octal to decimal (1336)8 = (1 x 83) + (3 x 82) + (3 x 81) + (6 x 80) = (1 x 512) + (3 x 64) + (3 x 8) + (6 x 1) = = 734 Thus (1336)8 = (734)10
19
Octal to binary look up each octal digit to obtain the equivalent group of three binary digits. Octal = 3 4 5 Binary = 011 100 101 = binary
20
Octal to hex When converting from octal to hexadecimal, it is often easier to first convert the octal number into binary and then from binary into hexadecimal. For example, to convert 345 octal into hex: Octal = 3 4 5 Binary = 011 100 101 = binary
21
Octal to hex Drop any leading zeros or pad with leading zeros to get groups of four binary digits (bits): Binary = Then, look up the groups in a table to convert to hexadecimal digits.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.