Chapter3 DC

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22

Hawassa University

Daye Campus

DEPARTMENT OF COMPUTER SCIENCE


For Your References

02/15/2023
Data Representation in Computer System
Data Representation in Computer
 Every computer stores numbers, letters, & other special characters in a coded form
not as it is.
 The 1st reason is that the electronic & electrical components, by their very nature,
operate in a binary mode.
 Information is handled in the computer by electronic/electrical components such as
transistors, semiconductors, wires, etc all of which can only indicate 2 states or
conditions – on(1) or off(0).
 Transistors are either conducting (1) or no conducting (0); a voltage is present (1) or
absent (0) in wire. The binary number system, which has only two digits (0&1),
02/15/2023
Data Representation in Computer…

 The 2nd reason is that the computer circuits only have to handle
two binary digits rather than ten decimal digits.
 Finally, the binary system is used because everything that can be
done in decimal number system (addition, subtraction, division
& multiplication) can also be done in binary number system.

02/15/2023
Numbering System

a. The Decimal Number System


 Uses number 10 as its base or radix.

 It is the most popular form of numbering system which is used by human being.

 It is also called base-ten system or natural number system.

 It includes the numbers or digits from 0-9.

02/15/2023
Cont’d…

Example: 6543.286 = (6 * 104-1) + (5*103-1) + (4*102-1) + (3*101-1) +


(2*10-1) + (8*10-2) + (6*10-3)
=(6 * 103) + (5*102) + (4*101) + (3*100) + (2*10-1) + (8*10-2)
+(6*10-3)
= 6000 + 500 + 40 + 3 + 0.2 + 0.08 + 0.006
= 6543.286

02/15/2023
Binary number System

 The most popular form which is understood by the computer.

 Its radix is 2.
 It uses two digits i.e. 0 & 1.
 Sometimes it is also called base-two system.

Example: (101)2, (011100)2, but not (1002)2

02/15/2023
Octal Number System

 The base is 8

 There are only 8 digits: 0,1,2,3,4,5,6,7


 It was once a popular number base, especially in the digital
equipment like old computer systems.
 It is rarely used today.

Example: (2341)8, (67701)8, but not (1289)8

02/15/2023
Hexadecimal Number System

 The base is 16

 Has 16 single-character digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

Example: (1A)16, (B5CD)16, (0EF)16

02/15/2023
A relationship among Binary & other number system

02/15/2023
Converting from One Number System to Another
Converting from another Base to Decimal (base 10)

Steps

Step 1:- Determine the positional value of each digit & multiply the obtained positional values by the digits
in the corresponding position.

Step 2:- Sum the products calculated in step 1. The total is the equivalent value in decimal

Example1: Convert (1001001)2 to decimal

Solution: (1001001)2 =1x26+0x25+0x24+1x23+0x22+0x21+1x20

Ans. = 73

Example2: convert (101.1)2 to decimal

Solution: (101.1)2 = 1x22 + 0x21 +1x20+1x2-1

= 1x4 + 0x2 + 1x1 + 1x ½

= 4 + 0 + 1 + 0.5
02/15/2023
Converting from Decimal to another Base (Division
Remainder Technique)
Steps

Step 1: Divide the decimal number to be converted by the value of the new base.

Step 2: Record the remainder from step 1 as the rightmost digit (least significant digit) of the 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)

Repeat step 3 & 4, recording remainder from right to left until the quotient become zero in step 3.

Note that the last remainder thus obtained will be the most significant digit of the new base

number

02/15/2023
Cont’d…

Example 1:

Convert 3010 to base 16 (hex-decimal)

Ans. 3010=(1E)16

Example 2: (35)10= (?)2


Ans. (100011)2

02/15/2023
Converting a Decimal Fraction to a fractional in base
B

Steps
Step 1: Multiply the given decimal fraction by the base B.
Step 2: Repeat step 1 using the multiplicand at each step the remaining
fraction part is identically zero, or until as many digit as desired have
been generated.
The successive integral parts are the successive digits of the number in
base B starting from the most significant end.

02/15/2023
cont’d…
Example: convert (4.75)10 in to binary, octal, and hexadecimal.

Solutions:-the integer part is 4 and its binary equivalent is 100.


And the fractional part is 0.75 and it can be converted as:

02/15/2023
Conversion of non-decimal base to another
non-decimal base

Steps
Step 1: Convert the original number to a decimal number (base 10)
Step 2: Convert the decimal number to the new base number.

Example: convert (111010)2 to octal.

02/15/2023
Cont’d….

Solution: Step 1: Convert from base 2 to base 10:


(111010)2 = (58)10
Step 2: Convert (58)10 to base 8: (58)10 = ( )8

Thus, (111010)2 = ( )8
NB: direct or 3 bits grouping system is also used to convert the number.
(See the table below)

02/15/2023
A brief summary on conversion from one base to another base

02/15/2023
Computer Storage Measurement

A computer system’ s data/ information storage capacity is represented by


bytes, kilobytes, megabytes,
gigabytes and terabytes.

1 B yte = 8 bits
1 Kilobyte (K B ) = 210 bytes = 1024 bytes

1 Megabyte (M B ) = 1024 KB = 210 × 210 bytes = 220 bytes

1 Gigabyte (GB ) = 1024 MB = 210 × 220 bytes = 230 bytes


1 Terabyte (TB ) = 1024 GB = 210 × 230 bytes = 240 bytes

02/15/2023
Computer Coding System

BCD (Binary Coded Decimal)


The idea of this coding scheme is to convert each digit of a decimal number into its
binary equivalent instead of converting the entire decimal value into a binary
number.

This makes the conversion process easier. All decimal digits are represented in B
CD by 4 bits.

02/15/2023
quize1

1) Convert the following numbers to the decimal form.

a. (1101.11)2 b. (4603)8 c. (1A81)16 d. (11001.0101)2

2) Find the value of y if (1110)2=(124)y

3) Find the value of y if (123y)16= (11074)8

02/15/2023
Assignment 1

02/15/2023
CHAPTER 4
C U NXT CLASS!!

02/15/2023

You might also like