Professional Documents
Culture Documents
Base 2
3. Octal number system :
Base 8
A number system which has base 8 is called
anoctal number system. Therefore, the octal Octal numbers are expressed
numbersystem uses 8 symbols, (0, 1, 2, 3, 4, 5, using only the digits 0-7.
6, 7) torepresent the number. Examples: 0, 1, 6, 7...
Let an octal number 124 and we need to find Octal numbers play a vital role
itsequivalent in decimal, then in representing and managing
file permissions in Unix-based
(1 x 8²) + (2 x 8¹) + (4 x 8°) Systems.
64+16+4= 84
Discrete mathematics
.. (124)8 = (84)10
In combinatorics and graph
The base of the octal number system is eight. It theory, octal numbers have
uses eight digits 0 1 2 3 4 5 6 𝑎𝑛𝑑 7 to form applications in set theory and
a number. network analysis.
4 Debugging
Decimal number can be convertedto binary by A hexadecimal number can be converted into
repeatedly dividing the number by 2 for decimal number by adding the products of
integer part and collecting the reminders. each digit and its corresponding weight. The
weights are power of 16.
The remainders can be written in the reverse
order(from bottom to top) to get binary result.
For fractional part, it has to be multiplied by Decimal to hexadecimal:
2 successively and collecting the carries, to
write from top to bottom. Decimal number can be converted to
hexadecimal by repeatedly dividing the number
The multiplication is by 16
repeated till the fractional part becomes zero for integer part and collecting the reminders.
or the required number of significant bit is The remainders can be written in the reverse
obtained. order (from bottom to top) to get hex result.
For fractional part, it has to be multiplied by 16
successively and collecting the carries, to write
Binary to decimal conversation: from top to bottom. The multiplication is
repeated till the fractional part becomes zero
A binary number can be converted into decimal or the required numbers of significant digits are
number by adding the products of obtained.
eachbitanditscorresponding weight.
Hexa decimal to binary :
Example:
(i) (101)2 = 1 × 2 Hexadecimal numbers can be converted into
2+0×2 binary numbers by converting each
1+1×2 hexadecimal digit to its 4-bit binary equivalent.
0
=4+0+1 Binary to hexa decimal:
= (5)10
(ii) (10011)2 = 1 × 2 Conversion from binary to hexadecimal is easily
4+0×2 accomplished by partitioning the binary
3+0×2 number into groups of four binary digits,
2+1×2 starting from the binary point to the left and to
1+1×2 the right. It may be necessary to add zeros to
0 the last group, if it does not end in exactly four
= 16 + 0 + 0 + 2 + 1 bits. Each group of 4-bits binary must be
= (19)10 represented by its hexadecimal equivalen .
(iii) (0.101)2 = 1 × 2
−1 + 0 × 2 Octal to decimal:
−2 + 1 × 2
−3 Anoctal number can be converted into decimal
= 1 × 0.5 + 0 + 1 × 0.125 number by adding the products of each digit
= 0.5 + 0 + 0.125 and its corresponding weight. The weights are
= (0.625)10 power of 8.
(iv) (1101011.1011)2
(1101011)2 = 1 × 2
Decimal to octal: Hexa decimal to octal:
Decimal number can be converted to octal by This can be achieved by first writing down the
repeatedly dividing the number by 8 for four bit binary equivalent of hexadecimal
integer part and collecting the reminders. The digit and then partitioning it into group of 3
remainders can be written in the reverse bits each.
order (from bottom to top) to get octal result.
For fractional part, it has to be multiplied by 8
successively and collecting the carries, to write
from top to bottom. The multiplication is
repeated till the fractional part becomes zero or
the required numbers of significant digits
are obtained.
Octal to binary:
(27)8=(010 111)2
(135)8=(001 011 101)2
(45.5)8=(100 101 .101)2
Octal to hexa decimal:
Binary to octal:
This can be achieved by first writing down the
Conversion from binary to octal is the simplest
three bit binary equivalent of octal digit
procedure by grouping the binary number
and then partitioning it into group of 4 bits
into groups of three binary digits, starting from
each.
the binary point to the left and to the right.
Binary codes are broadly classified into Numeric Excess-3 code is an important BCD code, is a 4
codes, Alphanumeric codes and bit code and used with BCD numbers
Error detecting codes. Numeric codes are as weights are not assigned, it is a kind of non-
further classified into weighted codes and non- weighted codes. Excess-3 code was used on
weighted codes. The most obvious way of some older computers, cash registers and hand
encoding digits is "natural BCD" (NBCD), where held portable electronic calculators.
each decimal digit is represented by its
corresponding four-bit binary value. This is also The Excess-3 code for a given decimal number
called "8421" encoding. is determined by adding '3' to each decimal
digit in the given number and then replacing
Standard binary coded decimal code is each digit of the newly found decimal number
commonly known as a weighted 8421 BCD by its four bit binary equivalent. The table gives
code, with 8, 4, 2 and 1 representing the the Excess-3 code.
weights of the different bits starting from the
most significant bit (MSB) and proceeding Excess-3 to decimal:
towards the least significant bit (LSB). The
weights of From given Excess-3 code, the equivalent
the individual positions of the bits of a BCD decimal number can be determined by first
code are: 2 splitting the number into four-bit groups,
3 = 8, 2 starting from radix point and then subtracting
2 = 4, 2 0011 from each four-bit group. This gives us
1 = 2, 2 8421 BCD equivalent of the given Excess-3
0 = 1. code, which can then be converted into the
equivalent decimal number.
Example:
The main advantage of the Binary Coded Determine the decimal equivalent for the
Decimal system is that it is a fast and Excess-3 code 1000110.
efficient system to convert the decimal
numbers into binary numbers as compared to
the pure binary system However, the
disadvantage is that BCD code is inefficient as
the states between 1010(decimal 10), and 1111
(decimal 15) are not used.
The Gray code was designed by Frank Gray at A complete alphanumeric code would include
Bell Labs in 1953. It belongs to a class of codes the 26 lowercase letters , 26 uppercase letters,
called the minimum change code. The 10 numeric digits, 7 punctuation marks and
successive coded characters never differ in anywhere from 20 to 40 other characters such
more than one-bit.The Gray code is a non- as +, /, * , # and so on. That is it represents all
weighted code. of the various characters and functions that
are found on a standard typewriter or
computer keyboard. The most common
Because of this, the· gray code is not suitable alphanumeric codes used are ASCII code,
for arithmetic operations but finds applications EBCDIC code and Unicode.
in input/output devices, some analog-to-
digital converters and designation of rows and
columns in Karnaugh map etc. ASCII code:
EBCDIC code:
Alpha numeric code:
The EBCDIC stands for Extended Binary Coded
Alphanumeric codes are also called character Decimal Interchange Code. IBM
codes due to their certain properties. invented this code to extend the Binary Coded
These codes are basically binary. These codes Decimal which existed at that time.
are used to write alphanumeric data,
including data, letters of the alphabet, All the IBM computers and peripherals use this
numbers, mathematical symbols and code. It is an 8 bit code and therefore can
punctuation marks which can be easily accommodate 256 characters. Below is given
understandable and can be processed by the some characters of EBCDIC code to get familiar
computers. with it.
Every Computer Programmer must understand There are several ways we can represent signed
Signed and Unsigned Numbers and its significance. numbers in binary, but the most common
Positive numbers are represented as unsigned representation used is called two’s complement
numbers. So we don’t need to use +ve sign in front method.
of them. However, when it comes to negative
numbers we use –ve sign. This shows that number is The term two’s complement is somewhat
negative and different from positive unsigned value. ambiguous, in that it is used in two different ways.
This is why it’s represented as signed numbers. First, as a representation, two’s complement is a
way of interpreting and assigning meaning to a bit
In Number System we’ve assumed, we have as many pattern contained in a fixed precision binary
bits as needed to represent numbers. But in quantity. Second, the term two’s complement is also
computers, we have a fix number of bits to used to refer to an operation that can be performed
represent value. These bit sizes are typically 8-bit, on the bits of a binary quantity.
16-bit, 32-bit, 64-bit. These sizes are usually multiple
of 8, because system memories are organized on an As an operation, the two’s complement of a
8-bit byte basis. number is formed by inverting all of the bits and
adding 1 to it. In a binary number being interpreted
When a specific number of bits being used to using the two’s complement representation, the
represent a number. This number determines the high order bit of the number indicates the sign. If
range of possible values that can be represented. the sign bit is 0, the number is positive, and if the
For example, there are 256 possible combinations of sign bit is 1, the number is negative. For positive
8-bits, therefore an 8-bit number can represent 256 numbers, the rest of the bits hold the true
distinct numeric values and the range is typically magnitude of the number. For negative numbers,
considered to be 0-255 (we have provided table in the lower order bits hold the magnitude of the
later part of this tutorial). So we can’t represent number. It is important to note that two’s
numbers larger than 255 using 8-bit number. complement representation can only be applied to
Similarly, 16 bits allows a range of 0-65535. fixed precision quantities, that is, quantities where
there are a set number of bits.
Until now we have only considered positive values
for binary numbers. When a fixed binary number is The 2’s complement method of representation is
used to hold positive values, it is considered as used because it reduces the complexity of the
unsigned. In this case, the range of positive values hardware in the ALU (arithmetic-logic unit) of a
that can be represented is from 0 – 2n-1, where n is computer’s CPU. Using a 2’s complement method,
the number of bits being used. all of the arithmetic operations can be performed by
the same hardware whether the numbers are
It is also possible to represent signed (negative as considered to be unsigned or signed. The bit
well as positive) numbers in binary. In this case, operations performed are identical; the difference
some part of the total range of values is used to comes from the interpretation of the bits. The
represent positive values, and the remaining of the interpretation of the value will be different
range is used to represent negative values. depending on whether the value is considered to be
unsigned or signed.
The integer variables are represented in a
signed and unsigned manner. The positive and
negative values are differentiated by using the
sign flag in signed numbers.
But in the digital system, it is not possible to As we already know, the unsigned numbers don't
use negative sign before them because the data have any sign for representing negative numbers. So
is in binary form in digital computers. the unsigned numbers are always positive.
For representing the sign in binary numbers, By default, the decimal number representation is
we require a special notation. positive. We always assume a positive sign in front
of each decimal digit.
Binary Numbers Representation:
There is no sign bit in unsigned binary numbers so it
can only represent its magnitude. In zero and one,
Our computer can understand only (0, 1)
zero is an unsigned binary number.
language. The binary numbers are represented
in both ways, i.e., signed and unsigned. There is only one zero (0) in this representation,
which is always positive. Because of one unique
The positive numbers are represented in both binary equivalent form of a number in unsigned
ways- signed and unsigned, but the negative number representation, it is known as unambiguous
numbers can only be described in a signed way. representation technique. The range of the
unsigned binary numbers starts from 0 to (2n-1).
The difference between unsigned and signed
numbers is that unsigned numbers do not use
any sign bit for positive and negative numbers
identification, but the signed number used.
2. Signed Numbers: Applications of Different Number System:
Decimal System:
The signed numbers have a sign bit so that it can
differentiate positive and negative integer numbers. Used for everyday calculations, financial
The signed binary number technique has both the transactions, and measurements.
sign bit and the magnitude of the number.
Binary System:
For representing the negative decimal number, the
corresponding symbol in front of the binary number Vital for computer programming, digital circuits,
will be added. and data storage.
The signed numbers are represented in three ways. Hexa Decimal System:
The signed bit makes two possible representations
of zero (positive (0) and negative (1)), which is an Commonly used in web development (color
ambiguous representation. codes) and memory representation.
1’s Complement:
2’nd Complement:
Understanding the different number systems AACEl. 2008. Recommended Practice 40R-08:
expands our mathematical and Contingency Estimating: Basic Principles.Association
technological horizons. From everyday life to for the Advancement of Cost Engineering
advanced computer science, the versatility of International, Morgantown, W.Va.
number systems is truly remarkable.
AACEL. 2009. 38R-06: Documenting the Schedule
Basis. Association for the Advancementof Cost
Engineering International, Morgantown, W.Va.