NUMBER SYSTEMS
DECIMAL (BASE 10) NUMBER
SYSTEM
Decimal system is the most commonly
used number system. Our present
system of numbers has 10 separate
symbols namely 0,1,2,3,4,5,6,7,8 and 9,
which are called Arabic numerals.
The base or radix of a number system
is defined as the number of different
digits, which can occur in each position
in the number system. The decimal
system has a base or radix of 10.
In a positional number system, the
position a symbol occupies in the
number determines the value it
represents.
The following shows the place values
for the integer +224 in the decimal
system.
Note that the digit 2 in position 1 has the
value 20, but the same digit in position 2 has
the value 200. Also note that we normally
drop the plus sign, but it is implicit.
The following shows the place values
for the decimal number 7508. We have
used 1, 10, 100, and 1000 instead of
powers of 10.
( )
Values
The following shows the place values for
the real number +24.13
Place values for an integer in the
decimal system
BINARY (BASE 2) NUMBER SYSTEM
The word binary is derived from the
Latin root bini (or two by two). In this
system the base b = 2 and we use
only two symbols,
The symbols in this system are often
referred to as binary digits or bits
(binary digit).
S = {0, 1}
OCTAL (BASE 8) NUMBER SYSTEM
The word octal is derived from the
Latin root octo (eight). In this system
the base b = 8 and we use eight
symbols to represent a number. The
set of symbols is
S = {0, 1, 2, 3, 4, 5, 6,
7}
HEXADECIMAL (BASE 16) NUMBER SYSTEM
The word hexadecimal is derived from
the Greek root hex (six) and the Latin
root decem (ten). In this system the
base
b = 16 and we use sixteen symbols to
represent a number. The set of symbols
is
S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E,
F}
Note that the symbols A, B, C, D, E, F
are equivalent to 10, 11, 12, 13, 14,
and 15 respectively. The symbols in
this system are often referred to as
hexadecimal digits.
NUMBER CONVERSIONS : DECIMAL TO
BINARY
Consider the integer and fractional parts
separately.
For the integer part,
Repeatedly divide the given number by 2,
and go on accumulating the remainders, until
the number becomes zero.
Arrange the remainders in reverse order.
For the fractional part,
Repeatedly multiply the given fraction by 2.
Accumulate the integer part (0 or 1).
If the integer part is 1, chop it off.
Arrange the integer parts in the order they
are obtained.
DECIMAL TO BINARY CONVERSION
Convert 93
10
to binary
93 / 2 = 46 remainder 1 (least significant
digit)
46 / 2 = 23 remainder 0
23 / 2 = 11 remainder 1
11 / 2 = 5 remainder 1
5 / 2 = 2 remainder 1
2 / 2 = 1 remainder 0
1 / 2 = 0 remainder 1 (most significant digit)
Ans: 1011101
BINARY TO DECIMAL CONVERSION
The easiest method for converting a
binary number to its decimal equivalent
is to use the Multiplication Algorithm
The following shows how to convert the
binary number (110.11)
2
to decimal:
(110.11)
2
= 6.75.
DECIMAL TO OCTAL
The following shows how to convert 126
in decimal to its equivalent in the octal
system. We move to the right while
continuously finding the quotients and
the remainder of division by 8. The
result is 126 = (176)
8
.
Conversion of decimal fraction to octal
fraction is carried out in the same
manner as decimal to binary except that
now the multiplication is carried out by 8.
Find the octal equivalent of (0.75)
10
.
Number (to be recorded)
0.75 8 = 6.00 6
0 x 8 = 0 0
(0.75)
10
=(0.6)
8
2.17
The following shows how to convert (23.17)
8
to decimal.
This means that (23.17)8 19.234 in decimal. Again, we
have rounded up 7 8
2
= 0.109375.
OCTAL TO DECIMAL
2.18
The following shows how we convert 126 in decimal to its
equivalent in the hexadecimal system. We move to the right
while continuously finding the quotients and the remainder
of division by 16. The result is 126 = (7E)
16
DECIMAL TO HEX
Find the hexadecimal equivalent of (0.75)
10
.
Number (to be recorded)
0.75 16 = 12.00 C (12 = C)
Thus (0.75)
10
= (0.C)
16
.
2.19
The following shows how to convert the
hexadecimal number (1A.23)
16
to decimal.
Note that the result in the decimal notation is not exact,
because 3 16
2
= 0.01171875. We have rounded this
value to three digits (0.012).
HEX TO DECIMAL
2.20
An alternative method for converting a small decimal
integer (usually less than 256) to binary is to break the
number as the sum of numbers that are equivalent to
the binary place values shown:
21
Example
Example: convert decimal 106 to binary
Step 1: You need 7 bits (see earlier slides for
explination).
Step 2: keep track of position values for bits
64 32 16 8 4 2 1

? ? ? ? ? ? ?
Step 3: Check leftmost position value (i.e. 64)
64 is less than 105, therefore
the first binary digit is 1
64 32 16 8 4 2 1

1 ? ? ? ? ? ?
subtract : 106  64 = 42
22
Example (continued2)
Step 4: Check next position value (i.e. 32)
32 is less than 42, therefore
the next binary digit is 1
64 32 16 8 4 2 1

1 1 ? ? ? ? ?
subtract : 42  32 = 10
Step 4(continued): Check next position value (i.e. 16)
16 is greater than 10, therefore
the next binary digit is 0
64 32 16 8 4 2 1

1 1 0 ? ? ? ?
23
Example (continued3)
Step 4(continued): Check next position value (i.e. 8)
8 is less than 10, therefore
the next binary digit is 1
64 32 16 8 4 2 1

1 1 0 1 ? ? ?
subtract : 10  8 = 2
Step 4(continued): Check next position value (i.e. 4)
4 is greater than 2, therefore
the next binary digit is 0
64 32 16 8 4 2 1

1 1 0 1 0 ? ?
24
Example (continued4)
Step 4(continued): Check next position value (i.e. 2)
2 is equal to 2, therefore
the next binary digit is 1
64 32 16 8 4 2 1

1 1 0 1 0 1 ?
Since the position value was equal to the number (i.e. 2) the rest of
the binary digits are all zeros
64 32 16 8 4 2 1

1 1 0 1 0 1 0
Answer: 1101010
Octal to Binary Conversion
Each octal number converts to 3 binary digits
To convert 653
8
to binary, just substitute code:
6 5 3
110 101 011
Show the octal equivalent of the binary number
(101110010)
2
101 110 010
The result is (562)
8
.
Binary to Hexadecimal
Conversion
The easiest method for converting binary to
hexadecimal is to use a substitution code
Each hex number converts to 4 binary digits
Show the hexadecimal equivalent of the binary
number (10011100010)
2
.
Solution
We first arrange the binary number in 4bit patterns:
0100 1110
0010
hexadecimal: (4E2)
16
.
What is the binary equivalent of
(24C)
16
Solution
Each hexadecimal digit is converted to 4bit patterns:
2 0010, 4 0100, and C
1100
The result is (001001001100)
2
.
2.28
Octalhexadecimal
conversion
Octal to hexadecimal and hexadecimal to octal conversion
BINARY REPRESENTATION OF
INTEGERS
Range of unsigned integers
#of Bits

8
16
Range

0 255
0 65,535
0 to 2
(n)
1
Ex: Store 7 in an 8bit memory location
First change the number to binary 111. Add five 0s to
make a total of N (8) bits, 00000111. The number is
stored in the memory location.
Example of storing unsigned
integers in two different computers
8bit allocation

00000111
11101010
overflow
overflow
overflow
16bit allocation


0000000000000111
0000000011101010
0000000100000010
0110000010111000
overflow
Range of signed integers
127 0
32767 0
2,147,483,647 0
+0 +127
+0 +32767
+0 +2,147,483,647
Range

SIGN AND MAGNITUTDE
In signandmagnitude representation,
the leftmost bit defines the sign of the number.
If it is 0, the number is positive. If it is 1, the
number is negative.
Eg: Store +7 in an 8bit memory location using signand
magnitude representation.
First change the number to binary 111. Add four 0s to
make a total of N1 (7) bits, 0000111. Add an extra zero
because the number is positive. The result is:
00000111
Note
There are two 0s in signandmagnitude
representation: positive and negative.
In an 8bit allocation:
+0 00000000
0 10000000
Store 258 in a 16bit memory location using signand
magnitude representation
First change the number to binary 100000010. Add six 0s
to make a total of N1 (15) bits, 000000100000010. Add an
extra 1 because the number is negative. The result is:
1000000100000010
Interpret 10111011 in decimal if the
number was stored as a signand
magnitude integer.
Ignoring the leftmost bit, the
remaining bits are 0111011. This
number in decimal is 59. The leftmost
bit is 1, so the number is 59.
ONES COMPLEMENT
If the sign is positive (0), no more
action is needed;
If the sign is negative, every bit is
complemented.(i.e. just replace every 0
with 1 and every 1 with 0 )
In ones complement representation,
the leftmost bit defines the sign of the
number. If it is 0, the number is positive.
If it is 1, the number is negative (Here
also 0 has two representation)
Store +7 in an 8bit memory location using
ones complement representation.
First change the number to binary 111. Add
five 0s to make a total of N (8) bits,
00000111. The sign is positive, so no more
action is needed. The result is:
00000111
Store 258 in a 16bit memory location
using ones complement representation
First change the number to binary 100000010. Add
seven 0s to make a total of N (16) bits,
0000000100000010. The sign is negative, so each bit is
complemented. The result is:
1111111011111101
Interpret 11110110 in decimal if the
number was stored as a ones
complement integer.
The leftmost bit is 1, so the number is negative. First
complement it . The result is 00001001. The complement in
decimal is 9. So the original number was 9. Note that
complement of a complement is the original
number.
Ones complement means reversing all bits. If
you ones complement a positive number, you
get the corresponding negative number. If you
ones complement a negative number, you get
the corresponding positive number. If you ones
complement a number twice, you get the original
number.
TWOS COMPLEMENT
Twos complement is the most
common, the most important, and the
most widely used representation of
integers today.
If the sign is positive, no further action
is needed;
If the sign is negative, find 2s
complement of a number by adding 1
to its 1s complement.
In 2s Complement there is one
unique 0. (i.e. The twos complement
of 0 is 0)
TWOS COMPLEMENT
To convert from decimal to two's
complement:
If number is positive, convert number from
decimal to binary
If number is negative:
Convert absolute value of number from decimal to
binary
Complement the bits
Add 1
In twos complement representation,
the leftmost bit defines the sign of the
number. If it is 0, the number is positive.
If it is 1, the number is negative.
Store +7 in an 8bit memory location using
twos complement representation.
First change the number to binary 111. Add
five 0s to make a total of N (8) bits,
00000111. The sign is positive, so no more
action is needed. The result is:
00000111
Store 258 in a 16bit memory location
using twos complement representation
First change the number to binary 100000010. Add
seven 0s to make a total of N (16) bits,
0000000100000010. The sign is negative, so each bit is
complemented. : 1111111011111101 add 1 to get 2s
complement :
1111111011111110
REPRESENTING CHARCTERS
IN MEMORY
ASCII CODE:
Acronym for the American Standard Code for
Information Interchange. Pronounced askee,
It is the most common format for text files in
computers and on the Internet. In an ASCII file,
each alphabetic, numeric, or special character is
represented with a 7bit binary number (a string
of seven 0s or 1s). 128 possible characters are
defined (0127).
There are 128 values ranging from 0 to 127, of
which 95 are printable characters and 33 are not
visible but used for control characters. Carriage
return (0xD
16
in hexadecimal) and linefeed (0xA
16
) are two of the better known control characters.
ISCII Code
Indian Standard Code for Information
Interchange. This is 8bit code capable of encoding
256 characters. ISCII retains all ASCII characters
and offers coding for Indian scripts also. Thus, also
called as Indian Scripts for Information
Interchange.
UNICODE
A 16bit character set standard, designed
and maintained by the nonprofit
consortium Unicode Inc.
Unicode was designed to be universal,
unique, and uniform, i.e., the code was to
cover all major modern written languages
(universal), each character was to have
exactly one encoding (unique), and each
character was to be represented by a fixed
width in bits (uniform).
Much more than documents.
Discover everything Scribd has to offer, including books and audiobooks from major publishers.
Cancel anytime.