complete number system
TRANSCRIPT
NUMBER SYSTEMS
Number Systems
• Binary– 0, 1
• Octal– 0, 1, 2, 3, 4, 5, 6, 7
• Decimal– 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
• Hexadecimal– 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
,8 ,Ooops! There is no 8 in octal
10, 11, 12, 13, 14, 15A, B, C, D, E, F
Data Representation in Computer Systems
• Bit– Binary digit– Either ON or OFF (high or low; 0 or 1)
• Byte– 8 bits– IBM System/360 mainframe computer established the use of 8 bits
as the basic unit of addressable computer storage• Word
– With two or more adjacent bytes– 16 bits, 32 bits, 64 bits
• Nibbles (nybbles)– the 4-bit halves of an eight-bit byte– Low-order nibble; high-order nibble
Positional Numbering Systems
In the decimal numbering system, what does 243 mean?
Positional Numbering SystemsGeneral Idea:A numeric value is represented through increasing power of a radix (or base)Examples:1) 243.5110 = 2*102
= 200 + 40 + 30 + 0.5 + 0.01
= 243.51Note: We are not doing a conversion here!
+ 4*101 + 3*100 + 5*10-1 + 1*10-2
Boardwork 1• Evaluate the following decimal numbers:
1.) 4310 2.) 52710 3.) 905110 4.) 1540110
5.) 12813610
Conversion from any Base to Base 10 Using Positional Numbering Systems
Examples (From any base to base 10):
2) 2123 to base 10= 2*32 + 1*31 + 2*30 = 18 + 3 + 2 = 2310
3)101102 to base 10= 1*24 + 0*23 + 1*22 + 1*21 + 0*20 = 16 + 0 + 4 + 2 + 0= 2210
• In general, the relationship between a digit, its position, and the base of the number system is expressed by the following formula:
Number Systems
Positional Numbering Systems
Board Work 2
• Convert the following to Base 10 (Decimal)
2. 138
4. 21738
3. 1000111102
5. 67F16
1. 4B16
ANSWERS
Conversion Base 10 (dec) to Any base
• Division Remainder Method– The remainders end up being the digits of the
result and are read from bottom to top
From Base 10 to Base 2
Most significant bit12 )
( 022 )
4210
1010102Answer:
( 152 )
( 02 )
(Least significant bit422 ) Quotient
210
Remainder
2 )10
( 1
( 10When quotient becomes 0,
division stops. Read bottom-up
From Base 10 to Base 16
5,73510
166716Answer:
016 )( 1 Most significant bit116 )( 62216 )( 635816 )( 7 Least significant bit5,73516 )
Quotient
Remainder
Boardwork 3
• Convert the following decimal numbers using division method:1. 104 to Base 32. 147 to Base 23. 803 to Base 164. 539 to Base 16
5. 1246 to base 166. 48 to base 27. 537 to base 88. 1576 to base 16
ANSWERS
Converting Fractions
• Multiplication Method– Multiply fractional part by radix– Set apart integer part– Continue multiplying fraction part by radix until it
becomes 0– Read integer part top to bottom
• Example: Convert 0.430410 to base 5.4304 * 5 = 2.1520 2.1520 * 5 = 0.7600 0.7600 * 5 = 3.8000 3.8000 * 5 = 4.0000 4 fractional part 0.
Done multiplying.
Answer: 0.20345
Boardwork 4
At least 3 bits to the right• Convert 0.37510 to binary• Convert 0.82510 to binary
ANSWERS
Conversion using Nibble Method
• Convert 1100100111012 to Octal and Decimal= 110 = 6= 62358
= 1100 = C = C9D16
010 011 101 2 3 5
1001 1101 9 D
Boardwork 5Convert the given base to base 21. EF16
2. 678
3. 9216
4. 1378
5. 1B116
Answers to Boardwork 2
1. 7510
2. 1110
3. 28610
4. 114710
5. 166310
Answers to Boardwork 3
• 102123
• 100100112
• 32316
• 21B16
• 4DE16
• 1100002
• 10318
• 62816
Answers to Boardwork 4
• 0.0112
• 0.1102
Checkup Quiz. Complete the table below. Show your solution(s).
Decimal Binary Octal Hexadecimal
54.812510
1101111.0112
11.48
1FD.A216
NUMBER SYSTEMS (contd)
Binary Addition
KEEP IN MIND the following rules:
• 0 + 0 = 0• 0 + 1 = 1• 1 + 0 = 1• 1 + 1 = 10
ExamplesTake note where and when it is necessary to carry the 1.
Boardwork
• Do the following binary additions:
1 0 1 0 1 1 1 0 1 1
1 1 1 0 0 1 1 1 0 0 0 1
Binary Subtration
• Take note of the following terms:Minuend – Subtrahend = Difference
KEEP IN MIND the following rules:• 0 - 0 = 0• 1 - 1 = 0• 1 - 0 = 1• 0 - 1 = 1 (we use the borrow system)
Examples
• Subtract the binary numbers 101012 and 11102
1
11
1
0110
11
1 0 0 2
Final Answer: 1112
seatwork (1/2 crosswise)• Add the binary equivalent of the following
decimal numbers: 1) 21 and 1152) 48 and 73) 4401 and 264) 7, 6, 13, 5, and 14
• Obtain the Difference of the binary equivalent of the following decimal numbers: 5) 2 from 106) 11 from 237) 45 from 136
Show your solutions!!!
Negative Values in Binary Number System
• Signed Magnitude (S.M.)• One’s Complement (O.C.)• Two’s Complement (T.C.)– When working with the above, we restrict the
numbers in an n-bit system.
Signed Magnitude• Use the most significant bit as the sign bit, 0
for positive, 1 for negative.– Examples
001100 12
101100 -12
000101 5
100101 -5
Complement Systems
• Complements are used in digital computers for simplifying the subtraction operation (and for logical manipulations).
• Two types of complements:– (r-1)’s complement or 1’s complement– r’s complement or 2’s complement
Diminished Radix Complement (r-1)
• 1’S complement is obtained by subtracting each digit by from 1
• Or put simply, 1’s complement of a binary number is formed by changing 1’s to 0’s and vice versa
Diminished Radix Complement (r-1)
• Examples: (changing 1’s to 0s and vice versa)1) 1011000 =2) 0101101 =
Solution (long method, subtract from each digit from 1)1) 1111111 – 1011000 = 01001112) 1111111 – 0101101 = 1010010
01001111010010
Radix Complement (r)
• 2’s complement in binary is obtained by getting the 1’s complement of the number then add 1
• Or the 2’scomplement can be also be performed by leaving all least significant zeros and the first nonzero digit unchanged, and then replacing 1’sby 0’sand 0’sby 1’s in all other higher significant digits.
Radix Complement (r)
• Examples (first method):obtain 1’s thencomplement add 1
1) 101100 010011 + 1 = 0101002) 1101100 0010011 + 1 = 00101003) 0110111 1001000 + 1 = 1001001
Radix Complement (r)
• Example (2nd method):– The 2’scomplement of 101100 is 010100.– The 2’scomplement of 0.0110 is 0.1010.
Subtraction with Complements• Example: Subtract 1000011 from 1010100
using 2’s complement. (7-bit system)1010100
2’s complement + 01111011 0010001
Overflow bit in two’s complement are ignored.
10101002 8410
10000112 6710
8410 – 6710 = 17
Subtraction with Complements• Example: Subtract 1000011 from 1010100
using 1’s complement1010100
1’s complement + 011110010010000
Final answer is 00100012
+1End-around carry 0010001
Seatwork: Convert / Compute
Compute using the indicated number representations (signed number, 1’s complement, and 2’s complement), and assume 8-bit number.• 7 + (-5) signed magnitude• -13 + (10) two’s complement• -9 + (-1) one’s complement• 12 + (-12) two’s complement
Binary Multiplication
• Multiply 111 by 101111
X 10000
+ 111 1110
Remember:1. Copy the multiplicand when the
multiplier is 1. 2. Write a row of zeros when the
multiplier is 0.3. Shift your results one column to
the left as you move to a new multiplier digit.
4. Add the results together using binary addition to find the product.
Binary Division
Answers to seatwork 1
1) 10000100002
2) 1101112
3) 10001010010112
4) 1011012
5) 10002
6) 11002
7) 10110112