3.number System
3.number System
3.number System
Number System
Contents
• What is number system
• Different types of number systems
• Conversions of number system
Number system
• When we type some letters or words, the computer translates
them in numbers as computers can understand only numbers.
A computer can understand positional number system where
there are only a few digits and these digits represent different
values depending on the position they occupy in the number.
Peoples do not use this system normally. The idea of this was
first given by Libnitz at seventeenth century. At 1854,
Mathematician Bool has introduced binary number system
and he also described algebras of binary system. That why
algebra related to binary system is called Boolean Algebra.
Binary number system
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
Hexadecimal number system
Hexa Decimal Binary Hexadecimal Decimal value
decimal values values value
digits
16-3 1/4096=0.000244
8 8 1000 140625
9 9 1001 16-2 1/256=0.0039062
5
A 10 1010
16-1 1/16
B 11 1011
16-0 0.0625
C 12 1100
161 1
D 13 1101
E 14 1110
162 16
F 15 1111
Conversion
• Decimal to Other Base System
• Other Base System to Decimal
• Other Base System to Non-Decimal
Decimal to Other Base System
• Step 1 - Divide the decimal number to be converted by the value of the
new base.
• Step 2 - Get the remainder from Step 1 as the rightmost digit (least
significant digit) of 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) of
the new base number.
• Example Operation result remainder
• Decimal Number : 2910 29/2 14 1
• Calculating Binary Equivalent: 14/2 7 0
2910=111012 7/2 3 1
3/2 1 1
1/2 0 1
Other systems to decimal
• Step 1 - Determine the column (positional) value of each digit (this
depends on the position of the digit and the base of the number system).
• Step 2 - Multiply the obtained column values (in Step 1) by the digits in
the corresponding columns.
• Step 3 - Sum the products calculated in Step 2. The total is the equivalent
value in decimal.
Step Binary Decimal
• Example
1 111012 ((1 x 24) + (1
• Binary Number : 111012 x 23) + (1 x
• Calculating Decimal Equivalent: 22) + (0 x 21)
+ (1 x 20))10
• Decimal number : 2910
2 111012 (16 + 8 + 4 +
0 + 1)10
3 111012 2910
Conversion between other system
• Step 1 - Convert the original number to a decimal (base 10) number
• Step 2 - Convert the number so obtained to the new base number.
• Example: Octal Number : 258
Calculating Binary Equivalent:
Octal Decimal
1 0
25 2*8 +5*8
25 16+5
25 21
03/21/2023 21
Binary Addition
It is a key for binary subtraction, multiplication, division. There are four rules of
binary addition.
The addition of two binary numbers follows three steps:
• Step 1: Add the first column
• Step 2: Record the unit digit of the column sum, if the sum exceeds “1”,
carry 1 goes to the next column
• Step 3: If there are additional columns or if there is a carry from step 2 ,
add the next column and repeat step 2, otherwise stop.
The facts needed for binary addition:
03/21/2023 22
Binary Addition
• EXAMPLE - ADDITION
03/21/2023 23
Binary Subtraction
Subtraction and Borrow, these two words will be used very frequently for the
binary subtraction. There are four rules of binary subtraction.
Subtraction can be performed by following two steps:
• Step 1: If the lower(Subtrahend) digit is greater than the upper(minuend)
digit, borrow from the next column to the left.
• Step 2: Subtract the lower value from the upper value
The facts needed for binary subtraction:
1 0–0 0 0
2 1–1 0 0
3 1–0 1 0
4 0–1 1 1
03/21/2023 24
Binary Subtraction
• EXAMPLE - SUBTRACTION
03/21/2023 25
Binary Multiplication
Binary multiplication is similar to decimal multiplication. It is
simpler than decimal multiplication because only 0s and 1s are
involved. There are four rules of binary multiplication.
03/21/2023 26
Binary Multiplication
03/21/2023 27
Binary Division
Binary division is similar to decimal division. It is called as the long
division procedure.
EXAMPLE - DIVISION
03/21/2023 28
Complements
• On binary representation, we saw how nonnegative
integer values like, 97 are represented in memory.
What if, instead of having 97, we had -97? We need a
way to represent negative integers.
• Complements are used in the digital computers in
order to simplify the subtraction operation.
• The two types of complements for the binary system
are 2's complement and 1's complement.
03/21/2023 29
Complements
Once
• Plus sign before a number to say that this is a positive
number and minus sign to say that this is a negative
number.
– Sign bit: 0 means positive number
– Sign bit: 1 means negative number
But this is not used anymore and complement system is
being used today.
03/21/2023 30
Complements
An unfortunate feature of Sign-Value representation is
that there are two ways of representing the value zero:
all bits set to zero, and all bits except the sign bit set to
zero.
03/21/2023 31
1's complement
03/21/2023 32
Disadvantages of 1's complement
03/21/2023 33
2's complement
• The 2's complement of binary number is obtained by adding 1 to
the Least Significant Bit (LSB) of 1's complement of the number.
• 2's complement = 1's complement + 1
• Example of 2's Complement is as follows.
03/21/2023 34
2’s Complement
• Binary subtraction can be performed by
adding two’s complement:
• -9+4 By binary complement
Two’s complement of 9: 10111 (1st bit is sign bit)
Binary number for 4: 00100 (1st bit is sign bit)
By addition 11011 (difference)
03/21/2023 35
Advantages of 2's complement
1. It lessens circuit
2. It increases operability
3. It lessens complexity
4. Lessens weight
5. Speed up processing
6. Reduces cost
03/21/2023 36
Numerical data representation
A binary digit or bit can represent only two symbols as it has
only two states '0' or '1'. But this is not enough for
communication between two computers because there we
need many more symbols for communication. These symbols
are required to represent 26 alphabets with capital and small
letters, numbers from 0 to 9, punctuation marks and other
symbols. For this there are
• BCD code
• Alphanumeric code
• Unicode
03/21/2023 37
BCD
Binary Coded Decimal(BCD):
• To encode Decimal digits Binary
• Requires 4 bits
• Weighted codes
• From left to right weights 8,4,2,1
• BCD representation of 469 is
4 6 9
0100 0110 1001
03/21/2023 38
BCD
03/21/2023 39
Alphanumeric codes
• ASCII:
– American Standard Code For Information Interchange.
– 8 bit codes
– used to represent characters and digits.
– First bit is used as parity bit, next 3 bits used as zone bit and
last 4bits used as numeric bits
• EBCDIC:
– Extended Binary coded Decimal Interchange Code.
– Developed by IBM.
– 8- bit representation.
– First 4 bits used as zone bit and last 4bits used as numeric bits
03/21/2023 40
Unicode
• 16- bit code
• Designed to support different international
languages(Like Bangla, Hindi, Chinese etc.) as
those languages have too many characters to
be represented by eight bit ASCII & EBCDIC
codes.
• Developed by Unicode Inc.
03/21/2023 41
EBCDIC vs. ASCII
1. EBCDIC uses 8 bits while ASCII uses 7 before it was
extended.
2. EBCDIC contained more characters than ASCII.
3. ASCII uses a linear ordering of letters while EBCDIC
does not.
4. Different versions of ASCII are mostly compatible
while different versions of EBCDIC are not.
5. EBCDIC isn’t compatible with modern encodings
while ASCII is.
03/21/2023 42
ASCII vs. Unicode
1. ASCII uses an 8-bit encoding while Unicode uses 16 bit encoding.
2. Unicode is standardized while ASCII isn’t.
3. Unicode represents most written languages in the world while
ASCII does not.
4. ASCII has its equivalent within Unicode.
5. ASCII means American Standard Code for Information
Interchange & UniCode means Universal Code
6. ASCII can represents 256 symbols and UniCode represents 65536
symbols.
7. ASCII requires less memory and Unicode requires much more
memory than ASCII
03/21/2023 43
ASCII vs. BCD
1. ASCII uses an 8-bit encoding while BCD uses 4 bit
encoding.
2. ASCII means American Standard Code for
Information Interchange & BCD means Binary
Coded Decimal
3. ASCII can represents 256 different symbols and BCD
represents 16 different symbols.
4. ASCII is used more than BCD
03/21/2023 44