Professional Documents
Culture Documents
These combination can provides enough possible patterns to represent the entire
alphabet(A-Z/a-z), numeric digits(0,1,2,…,9), special characters(!, ?, *, …)
Bytes are calculated by raising the number 2 to various power.
Words
Bytes are combined into groups of 1 to 8 bytes called words.
Words refer to the number of bits that a computer process at once.
Typically word lengths are 8 bits, 16 bits, 32 bits & 64 bits.
Decimal Octal
Binary
Hexadecimal
Converting from One Number System to Another
Steps
Step 1. Divide the decimal number to be converted by the value of
the new base.
Step 2 Record the remainder from step 1 as the rightmost digit
(least significant digit) of the new base number.
Step 3. Divide the quotient of the previous divide by the new base.
Step 4: Record the remainder from step 3 as the next digit (to the
left)
Repeat step 3 & 4, recording remainder from right to left until
the quotient become zero in step 3.
Note that the last remainder thus obtained will be the most
significant digit of the new base number.
June 15, 2023
Admas University
15
Converting a Decimal Fraction to a fractional in
base B
Steps
Step 1: Multiply the given decimal fraction by the base B.
Step 2: Repeat step 1 using the multiplicant at each step
the remaining fraction part is identically zero, or until as
many digit as desired have been generated.
The successive integral parts are the successive digits of
the number in base B starting from the most signif ic ant
end.
7058 = 1110001012
Hexadecimal to Binary
• Technique
Convert each hexadecimal digit to a 4-bit equivalent binary
representation
Decimal to Octal
• Technique
Divide by 8
Keep track of the remainder
Decimal to Hexadecimal
• Technique
Divide by 16
Keep track of the remainder
Binary to Octal
• Technique
Group bits in threes, starting on right
Convert to octal digits
Binary to Hexadecimal
• Technique
Group bits in fours, starting on right
Convert to hexadecimal digits
Octal to Hexadecimal
• Technique
Use binary as an intermediary
Hexadecimal to Octal
• Technique
Use binary as an intermediary
Exercise – Fill the blank with Converted
Hexa-
Decimal
Binary
Octal
decimal
33
1110101
703
1AF
1
0
1
0
1
1
0
1
• Example: Add the binary numbers 1111 and 1010.
1 1 1 1
+ 1 0 1 0
• 1 1 0 0 1 Thus the binary sum is (11001) 2.
Binary Addition (2 of 2)
• Two n -bit values
Add individual bits
Propagate carries
E.g.,
1
1
10101 21
+ 11001 + 25
101110 46
Binary Subtraction
• Subtraction is generally simple in comparison to addition since
only two numbers are involved.
• In binary subtraction the problem ‘borrow’ is similar to that in
decimal.
• If the subtracted bit is equal to or smaller than the minuend
bit, then perform subtraction, otherwise borrow one(the base 2)
from its left most neighbor.
• Find the binary difference of (1101-1011).
Binary Multiplication
• Binary, two n -bit values
• As with decimal values
• E.g.,
1110
x 1011
1110
1110
0000
1110
10011010
Coding Methods
• Code is a group of symbols
• Code is a systematic use of a given set of symbols for representing
information
• Code: A set of n-bit strings in which different bit strings represent
different numbers or other things.
• Weighted code :- Each positions are represent specific weight
Eg. 8 4 2 1 ,2 4 2 1
• Non-weighted code:- non positional codes
Eg ex-3,GrayCode
• Sequential codes:- Each succeeding code is one binary numbers greater than
the preceding code. Ex 8 4 2 1 , ex-3
• Alphanumerical codes:-we can represent number, characters, symbol and
small Instruction Ex. ASCII
4-Bit Binary Coded Decimal (BCD)
Systems
• The 4-bit BCD system is usually employed by the computer
systems to represent and process numerical data only.
To represent 10 decimal digits(0000:0 ….1001: 9), at
least need 4 bits.
• (Each decimal number ((base 10 i.e 0,1,2…9)) Represent by a
4 bit Binary binary (0,1) number )
• In the 4-bit BCD system, each digit of the decimal number is
Represented to its corresponding 4-bit binary sequence.
• The two most popular 4-bit BCD systems are:
Weighted 4-bit BCD code
Excess-3 (XS-3) BCD code
Weighted 4-Bit BCD Code
• The weighted 4-bit BCD code is more commonly known as 8421
weighted code (pronounce eight , four , two, one ).
8421 and BCD codes are the same
• It is called weighted code because it encodes the decimal
system into binary system by using the concept of positional
weighting into consideration.
• In this code, each decimal digit is encoded into its 4-bit
binary number in which the bits from left to right have the
weights 8, 4, 2, and 1, respectively.
Weighted 4-Bit BCD Code
Apart from 8421, some other weighted BCD codes are 4221,
2421 and 5211
Weighted 4-Bit BCD Code
• Example :- Represent the decimal number 5327 in 8421 BCD
code.
The corresponding 4-bit 8421 BCD representation of decimal digit 5 is
0101
The corresponding 4-bit 8421 BCD representation of decimal digit 3 is
0011
The corresponding 4-bit 8421 BCD representation of decimal digit 2 is
0010
The corresponding 4-bit 8421 BCD representation of decimal digit 7 is
0111
Therefore, the 8421 BCD representation of decimal number 5327 is
0101001100100111.
Binary Coded Decimal (BCD)
Example Represent the decimal number 938 in 8421 BCD code.
8
4
2
1
8
4
2
1
8
4
2
1
1
0
0
1
0
0
1
1
1
0
0
0
8 + 0 + 0 + 1
0 + 0 + 2 + 1
8 + 0 + 0 + 0
9
3
8
• Therefore 1001 0011 1000 in BCD = 938 in denary.
Reading Assignment
UNICODE