Number Systems: Lecture 2 - Intro To Info. & Comm. Technologies
Number Systems: Lecture 2 - Intro To Info. & Comm. Technologies
Number Systems: Lecture 2 - Intro To Info. & Comm. Technologies
128 64 32 16 8 4 2 1
1 0 1 0 1 0 1 1
Step 2 19FDE (1 x 164) + (9 x 163) + (15 x 162) +(13 x 161) + (14 x 160)
• Has 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Decimal to Binary
• Technique
– Divide by two, keep track of the remainder
125 10 = ? 2 2 125
62 1
2
31 0
2
15 1
2
7 1
2
3 1
2
1 1
125 10 = 1111101 2
Decimal to Hexadecimal
1234 10 = ? 16
16 1234
16 77 2
16 4 13 = D
0 4
1234 10 = 4D2 16
Converting Hexadecimal to Binary and Vice
Versa
Hexadecimal to Binary
•We know that the largest digit in hexadecimal is F,
and this digit requires 4 bits for binary
representation.
10AF16 = ?2
1 0 A F
10AF16 = 00010000101011112
Binary to Hexadecimal
• Make Quadruplets of bits from right to left.
• (01101101) 2
= +(109) 10
• (11101101) 2
= -(109)
10
• (00101011) 2
= +(43)
10
• (10101011) 2
= -(43)
10
Signed Magnitude Representation
• Range of values for positive number:
1 to 127
• Range of values for negative numbers:
-127 to -1.
Problem:
• Positive zero and negative zero.
• Example: (11010001)
Find the decimal of (1010001) which is 81. Since the
sign bit is 1, so the number is -81.
1’s Complement
• To represent a negative number in 1’s complement,
first find its positive binary counterpart.
• Then inverse the bits.
• For example: Represent -2 using 1 byte in 1’s
complement.
❑ 2= 00000010
❑ -2= 11111101
• If the most significant bit is 0, then the number is positive, and simply
find its decimal equivalent.
• If the most significant bit is 1, then the number is negative. So, first apply
1’s complement (to convert the negative binary number into positive
binary number), then find the decimal equivalent and put – sign.
• Example: (11010011)
1. Finding 1’s complement since msb is 1: 00101100.
2. Now find the decimal equivalent: 44
3. Put negative sign. (-44)
2’s complement
• First find 1’s complement.
• If the most significant bit is 0, then number is positive and simply find its
decimal equivalent.
• If the most significant bit is 1, then number is negative. So, first apply 2’s
complement (to convert it into positive binary number), then find the
decimal equivalent of positive binary number and put – sign.
• Example: (11010011)
1. Finding 2’s complement since msb is 1: 00101101.
2. Now find the decimal equivalent: 45
3. Put negative sign. (-45)
Data Representation in Computers
What is Data
Data is simply
any numbers, letters or symbols that can be
entered into a computer system.
Everything is numbers!
Memory Measuring Units
(As viewed by computer scientists)
Most computers can process millions of bits every second. A hard drive's storage capacity is
measured in gigabytes or terabytes. RAM is often measured in megabytes or gigabytes.
How Images are Stored in Memory
0 0 255 0 0
0 0 255 0 0
0 0 255 0 0
255 255 255 255 255
0 0 255 0 0
0 0 255 0 0
0 0 255 0 0
How To Represent Color Images in Memory
RGB
• https://www.khanacademy.org/computing/comp
uter-science/how-computers-work2/v/khan-acad
emy-and-codeorg-introducing-how-computers-w
ork
• https://www.youtube.com/watch?v=ptzGI9VaZm
Q
Activity