Professional Documents
Culture Documents
In
Computers
Digital Representation of Data?
• Data is defined as the symbols that represent
things, people, events and ideas
• Computers store data in digital format as a series of
1s and 0s (known as binary code)
• The term bit comes from “binary digit”
• Digital data is made up of discrete numbers, with
each bit being either a 1 or a 0 – it’s either on or off,
nowhere in between
• Analog data is made up of a continuous wave of
information, with varying degrees in between
4
For example:
➢A digital clock changes it’s digital display
once every minute to show the time
➢An analog clock is continually moving it’s
second, minute and hour hands to show
the time
6
Positional Number Systems
Different Representations of Natural Numbers
• Bit Numbering 27 26 25 24 23 22 21 20
Some common
powers of 2
Binary to Decimal Conversion
• 10011011)2 = ( ? )10
• Every binary number is a sum of powers of 2
• Decimal Value = (dn-1 2n-1) + ... + (d1 21) +
(d0 20)
• Binary (10011011)2 = 27 + 24 + 23 + 22 + 1 =
• Answer: …..
7 6 5 4 3 2 1 0
1 0 0 1 1 1 0 1
27 26 25 24 23 22 21 20
Some common
powers of 2
Binary to decimal Conversion
• 10101.101
• 100001
• 1111.011
• (1010101011.1101)2
Decimal to Binary Conversion
• Repeatedly divide the decimal integer by 2
• Each remainder is a binary digit in the translated value
37 = (100101)2
• 10
• 25
• 15
• 16
• 57.125
Hexadecimal Integers
• 16 Hexadecimal Digits: 0 – 9, A – F
• More convenient to use than binary numbers
Binary, Decimal, and Hexadecimal Equivalents
Binary to Hexadecimal Conversion
❖ Example:
❖ Solution:
E B 1 6 A 7 9 4
1110 1011 0001 0110 1010 0111 1001 0100
Converting Hexadecimal to Decimal
• Multiply each digit by its corresponding power of 16
Value = (dn-1 16n-1) + (dn-2 16n-2) + ... + (d1 16) + d0
least significant
digit
most significant
digit
stop when
quotient is
zero
Decimal 422 = 1A6 hexadecimal
Binary Addition
• Start with the least significant bit (rightmost bit)
• Add each pair of bits
• Include the carry in the addition, if present
carry 1 1 1 1
0 0 1 1 0 1 1 0 (54)
+ 0 0 0 1 1 1 0 1 (29)
0 1 0 1 0 0 1 1 (83)
bit position: 7 6 5 4 3 2 1 0
Hexadecimal Addition
• Start with the least significant hexadecimal digits
• Let Sum = summation of two hex digits
• If Sum is greater than or equal to 16
• …..Sum = Sum – 16 and Carry = 1
• Example:
carry: 1 1 1
1C37286A
+ A + B = 10 + 11 = 21
9395E84B Since 21 ≥ 16
Sum = 21 – 16 = 5
AFCD10B5 Carry = 1