Sunteți pe pagina 1din 7

Course Code & Course: DEC3033 – COMPUTER ARCHITECTURE & ORGANIZATION

Assessment: End of Chapter 2


Class: DTK
SLT (Independent Learning) : 4 hours Total marks : _______ / 30
TITLE : NUMBER SYSTEM
OUTCOMES : Upon completion, students should be able to :
i. Solving the conversion of the following number systems in 8 bit:
a. Octal number system
b. Hexadecimal number system
c. Floating point number system
d. ASCII code number system
e. Decimal number system
THEORY
BINARY TO DECIMAL CONVERSION
The conversion process is straight forward and is done as follows: Multiply binary digit (1 or 0) in each
position by the weight of the position and add the results.
Examples :
a. 11012 = (1 x 23 + 1 x 22 + 0 x 21 + 1 x 20) =8+4+0+1 = 1310
b. 10012 = (1 x 23 + 0 x 22 + 0 x 21 + 1 x 20) =8+0+0+1 = 910
c. 0.0112 = (0 x 2-1 + 1 x 2-2 + 1 x 2-3) = 0 + 0.25 + 0.125 = 0.37510
d. 0.1112 = (1 x 2-1 + 1 x 2-2 + 1 x 2-3) = 0.5 + 0.25 + 0.125 = 0.87510
e. 110.0112 = (1 x 22 + 1 x 21 + 0 x 20 + 0 x 2-1 + 1 x 2-2 + 1 x 2-3)
= 4 + 2 + 0 + 0 + 0.25 + 0.125 = 6.37510

DECIMAL TO BINARY CONVERSION


It is frequently necessary to convert decimal numbers to equivalent binary numbers. The two most
frequently used methods for making the conversion are :
 Whole-number conversion: Repeated division-by-2
 Fractional number conversion: Multiplication-by-2

Page 1 of 7
Examples :
a. 1910

1910 = 2 19
2 9  1 (LSB)
2 4  1
2 2  0
2 1  0
0  1 (MSB)
1910 = 100112
b. 0.4062510 = 0.40625 x 2 = 0.8125  0 (MSB)
= 0.8125 x 2 = 1.625 1
= 0.625 x 2 = 1.25 1
= 0.25 x 2 = 0.5 0
= 0.5 x 2 = 1.0  1 (LSB)
0.62510 = 0.011012
c. 0.610 = 0.6 x 2 = 1.2  1 (MSB)
= 0.2 x 2 = 0.4 0
= 0.4 x 2 = 0.8 0
= 0.8 x 2 = 1.6 1
= 0.6 x 2 = 1.2  1 (LSB)
0.610 = 0.100112

OCTAL TO DECIMAL CONVERSION


Octal numbers are converted to their decimal equivalent by multiplying the weight of each position
by the digit in that position and adding the products. This is illustrated in the following examples.
Examples:
a. 358 = (3 x 81 + 5 x 80) = 24 + 5 = 2910
b. 1308 = (1 x 82 + 3 x 81 + 0 x 80) = 64 + 24 + 0 = 8810
c. 0.248 = (0 x 80 + 2 x 8-1 + 4 x 8-2) = 0.25 + 0.0625 = 0.312510

DECIMAL TO OCTAL CONVERSION

To convert decimal numbers to their octal equivalent, the following procedures are employed:
 Whole-number conversion: Repeated division-by-8.
 Fractional number conversion: Repeated multiplication-by-8.

Page 2 of 7
Examples :
a. 24510

24510 = 8 245
8 30  5 (LSD)
8 3  6
0  3 (MSD)
24510 = 3658
b. 0.43210 = 0.432 x 8 = 3.456  3 (MSD)
= 0.456 X 8 = 3.648 3
= 0.648 x 8 = 5.184 5
= 0.184 x 8 = 1.472  1 (LSD)
0.43210 = 0.33518

HEXADECIMAL TO DECIMAL CONVERSION


Hexadecimal numbers are converted to their decimal equivalent by multiplying the weight of each
position by the digit in that position and adding the products. This is illustrated in the following
examples.
Examples:
d. 12C16 = (1 x 162 + 2 x 161 + 12 x 160) = 256 + 32 + 13 = 30010
e. D1B16 = (13 x 162 + 1 x 161 + 11 x 160) = 3328 + 16 + 11 = 335510
f. 0.3316 = (0 x 160 + 3 x 16-1 + 3 x 16-2) = 0 + 0.1875 + 0.01171875 = 0.1992187510

DECIMAL TO HEXADECIMAL CONVERSION

To convert decimal numbers to their hexadecimal equivalent, the following procedures are employed:
 Whole-number conversion: Repeated division-by-16.
 Fractional number conversion: Repeated multiplication-by-16.

Page 3 of 7
Examples :
a. 5410

5410 = 16 54
16 3  6 (LSD)
0  3 (MSD)
5410 = 3616
b. 0.8710 = 0.87 x 16 = 13.92  D (MSD)
= 0.92 x 16 = 14.72 E
= 0.72 x 16 = 11.52 B
= 0.52 x 16 = 8.32  8 (LSD)
0.8710 = 0.DEB816

BINARY TO OCTAL CONVERSION

The binary number is divided into groups to three bits, counting to the right and to the left from the
binary point and then each group of three is interpreted as an octal digit.

Examples :

a. 11010101.011012

011 010 101 . 011 010


3 2 5 . 3 2
110101012 = 325.328

BINARY TO HEXADECIMAL CONVERSION

The binary number is divided into groups to four bits, counting to the right and to the left from the
binary point and then each group of four is interpreted as an hexadecimal digit.

Examples :

a. 111010101.011012

0001 1101 0101 . 0110 1000


1 D 5 . 6 8
110101012 = 1D5.6816

BINARY TO ASCII CODE CONVERSION

Computers work in binary code. Information is coded using 0s and 1s. Each 0 or 1 is called a bit. In the
early years of computer development, different computer companies applied the binary system in

Page 4 of 7
their own way. The code for the letters in the word “cat” was often different in different brands of
computers.
Eventually, a set of standards was developed. Computer manufacturers agreed to use one code called
the ASCII (American Standard Code for Information Interchange). ASCII is an 8-bit code. That is, it uses
eight bits to represent a letter or a punctuation mark. Eight bits are called a byte. A binary code with
eight digits, such as 1101 10112, can be stored in one byte of computer memory.
Examples :
a. The word "CAT" in a word processor becomes 0100 00112, 0100 00012, and 0101 01002.
b. The word "cat" is 0110 00112, 0110 00012, and 0111 01002.

FLOATING POINT NUMBER REPRESENTATION


A floating-point number (or real number) can represent a very large (1.23×1088) or a very small
(1.23×10-88) value. It could also represent very large negative number (-1.23×1088) and very small
negative number (-1.23×1088), as well as zero, as illustrated:

Page 5 of 7
In computers, floating-point numbers are represented in scientific notation of fraction (F)
and exponent (E) with a radix of 2, in the form of F×2E. Both E and F can be positive as well as negative.
Modern computers adopt IEEE 754 standard for representing floating-point numbers. There are three
representation schemes:
a. 8-bit floating point
b. 32-bit single precision floating point
c. 64-bit double precision floating point

8-BIT FLOATING POINT NUMBER REPRESENTATION

Sign Exponent Mantissa


1 bit 3 bit 4 bit
0 100 0101
8-bit floating point number
Examples :
a. Convert 2.625 to our 8-bit floating point format.
b. Convert to binary  2.62510 = 10.1012
c. Add an exponent of two  10.1012 = 10.1012 × 20
d. Normalize the number  10.1012 × 20 = 1.01012 × 21
e. Mantissa: 0101
f. Exponent + bias = 1 + 3 = 4  1002 . (bias : 2k−1 − 1) ; k is the number of bits in exponent
field.
g. Sign bin is 0.
h. Result  0 100 0101
i. 010001012 = 4516

Page 6 of 7
QUESTIONS

1. Convert the following decimal numbers into binary and hexademical number. (3m)
a. 108
b. 48.48
c. 903.3

2. Convert the following binary numbers into hexademical and decimal number. (3m)
a. 1000011000
b. 10001.100
c. 1010101.01010

3. Convert the following octal numbers into binary and hexadecimal number. (3m)
a. 434
b. 7.01
c. 45.6
4. Below is a question that is in ASCII code. Using the provided ASCII translation table,
translate the question and answer it in the area provided. (3m)
a. 01000100 01001001 01010000 01001100 01001111 01001101 01000001
b. 01001001 01001110 01001111 01010101 01010010
c. 01001000 01000001 01001110 01000100

5. Represent each of the following using the 8-bit floating-point format. (18m)
a. 2.25
b. -80.0
c. 1/32

Page 7 of 7

S-ar putea să vă placă și