Binary Number System
Binary Number System
Decimal system
Binary system
Hexadecimal system
Octal system
Decimal System
The decimal system is the most common number
system used by human beings.
It is a positional number system that uses 10 as a
base to represent different values. Therefore, this
number system is also known as base 10 number
system.
In this system, 10 symbols are available for
representing the values. These symbols include the
digits from 0 to 9. The common operations
performed in the decimal system are addition (+),
subtraction (-), multiplication (), and division (/).
Decimal System
The decimal system can be used to represent both
the integer as well as floating point values. The
floating point values are generally represented in this
system by using a period called decimal point.
The decimal point is used to separate the integer part
and the fraction part of the given floating point
number.
The value of any number represented in the decimal
system can be determined by first multiplying the
weight associated with each digit in the given number
with the digit itself and then adding all these values
produced as a result of multiplication operation.
Decimal System
6543.124
Digit 6 5 4 3 . 1 2 4
Decimal
Weight 103 102 101 100 Point 10-1 10-2 10-3
1011.101
Digit 1 0 1 1 . 1 0 1
Binary
Weight 23 22 21 20 Point 2-1 2-2 2-3
Hexadecimal System
The hexadecimal system is a positional number
system that uses base 16 to represent different
values. Therefore, this number system is known as
base-16 system.
As this system uses base 16, 16 symbols are
available for representing the values in this system.
These symbols are the digits 0-9, which are used to
represent the decimal values 0 through 9, and the
letters A, B, C, D, E and F, which are used to
represent the decimal values 10 through 15.
Hexadecimal System
The weight associated with each symbol in the given
hexadecimal number can be determined by raising 16 to a
power equivalent to the position of the digit in the number.
4A90.2BC
Digit 4 A 9 0 . 2 B C
Hexadecimal
Weight 163 162 161 160 Point 16-1 16-2 16-3
Octal System
The octal system is the positional number system
that uses base 8 to represent different values.
Therefore, this number system is also known as
base-8 system.
2157.075
Digit 2 1 5 7 . 0 7 5
Octal
Weight 8 3
8 2
8
1
8 0
Point 8-1 8-2 8-3
4-Bit Binary Coded
Decimal (BCD) Systems
The BCD system is employed by computer systems to
encode the decimal number into its equivalent binary
number.
This is generally accomplished by encoding each digit
of the decimal number into its equivalent binary
sequence.
The main advantage of BCD system is that it is a fast
and efficient system to convert the decimal numbers
into binary numbers as compared to the pure binary
system.
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. In the 4-bit BCD system, each
digit of the decimal number is encoded to its
corresponding 4-bit binary sequence. The two most
popular 4-bit BCD systems are:
1 1+1 0
1 1+1 1
Gray Code
We can also convert a number represented in the
binary form to Gray code representation. For carrying
out this conversion, we need to remember the
following two rules:
The Most Significant Bit (MSB) of the binary number
and the gray coded number is always the same.
The next MSD of the gray coded number can be
obtained by adding the subsequent pair of bits of the
binary number starting from the left.
Gray Code
Binary Digit Binary Gray Coded
Examples 6.12-6.13, Addition Digit
p107. Operation
6.12: Convert the 1 1
binary number 0 1+0 1
10100011 to its
1 0+1 1
equivalent Gray coded
number. 0 1+0 1
Non-decimal to decimal
Decimal to non-decimal
Octal to hexadecimal
Non-Decimal to Decimal
The non-decimal to decimal conversions can be
implemented by taking the concept of place values
into consideration. The non-decimal to decimal
conversion includes the following number system
conversions:
3 6 5
0 F 5
Therefore, the equivalent hexadecimal number is F5.
Computer Arithmetic
Computer Arithmetic
A computer system stores and processes billions of instructions
in a second that involves a lot of arithmetic computations. The
different arithmetic operations in the computer system are
preformed by the Arithmetic and Logic Unit (ALU).
Binary addition
Binary multiplication
Binary subtraction
Binary division
Binary Addition
Like decimal system, we can start the addition of two
binary numbers column-wise from the right most bit
and move towards the left most bit of the given
numbers. However, we need to follow certain rules.
1 0 1 0 1 0
+ 0 1 0 0 1 1
1 1 1 1 0 1
Binary Addition
We can also perform the binary addition on more
than two binary numbers.
A B C A+B+C Carry
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Binary Addition
Example 7.4, p124: Perform the binary addition
operation on the following three numbers: 0010, 0001,
0111.
0 0 1 0
0 0 0 1
+ 0 1 1 1
1 0 1 0
Binary Multiplication
The multiplication of two binary numbers can be carried out in the same manner as the
decimal multiplication.
Unlike decimal multiplication, only two values are generated as the outcome of multiplying
the multiplication bit by 0 or 1 in the binary multiplication. These values are either 0 or 1.
The binary multiplication can also be considered as repeated binary addition. Therefore, the
binary multiplication is performed in conjunction with the binary addition operation.
Binary Multiplication
A B AB Example 7.6, p127: Perform the binary
multiplication of the decimal numbers 12 and 10.
0 0 0
0 1 0 The equivalent binary representation of the decimal number 12 is 1100.
The equivalent binary representation of the decimal number 10 is 1010.
1 0 0
1 1 0 0
1 1 1 1 0 1 0
Binary multiplication 0 0 0 0
does not involve the 1 1 0 0
concept of carry. 0 0 0 0
1 1 0 0
1 1 1 1 0 0 0
Binary Subtraction
The binary subtraction is performed in the same way
as the decimal subtraction. Like binary addition and
binary multiplication, binary subtraction is also
associated with a set of rules that need to be
followed while carrying out the operation.
A B A-B Borrow
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
Binary Subtraction
Examples 7.10 and 7.11, p129.
7.11: Perform the binary subtraction of the following
numbers: 10101 and 01110
1 1 1
1 0 1 0 1
- 0 1 1 1 0
0 0 1 1 1
Binary Division
Binary division is also performed in the same way as we perform decimal division. Like decimal
division, we also need to follow the binary subtraction rules while performing the binary division.
The dividend involved in binary division should be greater than the divisor. The following are the
two important points, which need to be remembered while performing the binary division.
If the remainder obtained by the division process is greater than or equal to the divisor, put 1 in
the quotient and perform the binary subtraction.
If the remainder obtained by the division process is less than the divisor, put 0 in the quotient
and append the next most significant digit from the dividend to the remainder.
Binary Division
Examples 7.14 and 7.15, p130.
7.15: Perform the binary division of the decimal numbers 18
and 8.
1 0 0 0 ) 1 0 0 1 0 ( 1 0 Quotient
1 0 0 0
0 0 0 1 0
0 0 0 0 0
0 0 0 1 0 Remainder
Signed/Unsigned Numbers
The unsigned binary number is the number with a
magnitude of either zero or greater than zero, and
are usually represented using the unsigned-
magnitude representation, which only represents the
magnitude of the numbers.
0 0 1 1 0 0 1 0 50
Sign bit
1 0 1 1 0 0 1 0 -50
Signed/Unsigned Numbers
Advantages of the signed-magnitude representation:
Ones complement
Twos complement
Ones Complement
Ones complement method can be used to represent
negative binary numbers.
Sign bit
1 1 1 1 0 0 0 0 -15
Ones Complement
Integers Ones complement representation
-7 1000
-6 1001 The ones complement
-5 1010
method of representing
-4 1011
signed numbers also
-3 1100
-2 1101
has two different
-1 1110 representations for the
-0 1111 number, zero.
+0 0000
+1 0001
+2 0010
+3 0011
+4 0100
+5 0101
+6 0110
+7 0111
Ones Complement
Example 7.18 (P134): Represent -25 in the ones
complement system in byte size.
Sign bit
1 1 1 1 0 0 0 1 -15
Twos Complement
Integers Twos complement representation
-7 1001
-6 1010
-5 1011
-4 1100
-3 1101
-2 1110
-1 1111
-0 0000
+0 0000
+1 0001
+2 0010
+3 0011
+4 0100
+5 0101
+6 0110
+7 0111
Twos Complement
Example 7.21 (P136): Represent -33 in the twos
complement system in byte size.
Integer representation
Floating-point representation
Integer Representation
Integer numbers are those numbers which do not
have fractional parts. Integer numbers include both
positive numbers and negative numbers. They can be
handled using any of the following representations:
325.123 3.25123102
0.000000245 2.4510-7
Floating-Point
Representation
A binary number can be represented in the scientific
notation by using base 2.
1000.0101 1.000010123
Floating-Point
Representation
A given number can be stored in the scientific
notation in different forms.
4333.123
4.333123103
43.33123102
433.3123101