0% found this document useful (0 votes)
84 views

Data Representation: Number Systems

The document discusses different number systems used in computers and their conversions. It covers decimal, binary, octal and hexadecimal number systems. It explains how computers use the binary system and how other systems like decimal are converted to binary. It also discusses concepts like bytes, ASCII character encoding and data storage units used in computers.

Uploaded by

Erl Ligsay
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Data Representation: Number Systems

The document discusses different number systems used in computers and their conversions. It covers decimal, binary, octal and hexadecimal number systems. It explains how computers use the binary system and how other systems like decimal are converted to binary. It also discusses concepts like bytes, ASCII character encoding and data storage units used in computers.

Uploaded by

Erl Ligsay
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 32

Data Representation

Number systems

Number system
Counting things identifying the quantity of something. the set of symbols used to express quantities as the basis for counting, determining order, comparing amounts, performing calculations, and representing value.
3

Number system
People and computers do not normally speak the same language. Methods of translating information into forms that are understandable and usable to both are necessary. Humans generally speak in words and numbers expressed in the decimal number system, while computers only understand coded electronic pulses that represent digital information.
4

Decimal System
Based on decimal digits
0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Decimal system has a base of 10


75 = 7 x 101 + 5 x 100 8563 = 8 x 103 + 5 x 102 + 6 x 101 + 3 x 100 0.368 = 3 x 10-1 + 6 x 10-2 + 8 x 10-3
Review of exponentiation:

an a a
n

an

1 an

(a 0)
5

Decimal System
Decimal system has a base of 10
75 = 7 x 101 + 5 x 100 8563 = 8 x 103 + 5 x 102 + 6 x 101 + 3 x 100 0.368 = 3 x 10-1 + 6 x 10-2 + 8 x 10-3
104 103 102 101 100 10-1 10-2 10-3

10000

1000

100

10

0.1

0.01

0.001

Decimal System
For example, the number 657 is equivalent to: 6X102 + 5X101 + 7X100 7 sum 50 600 657

Binary System
Binary system has only two digits
0 and 1

Binary system has a base of 2


102 = 1 x 21 + 0 x 20 10.1012 = 1 x 21 + 0 x 20 + 1 x 2-1 + 0 x 2-2 + 1 x 2-3

To differentiate binary system and decimal system, we can use the following notations:
Decimal: 7510, 11010 Binary: 10102

Binary System
M u lt ip le s o f 2 2 D e c im a l e q u iv a le n t 16 8 4 2 1 0 .5 0 .2 5 0 .1 2 5
4

-1

-2

-3

1X22 + 1X21 + 0X20

0 2 4 610

sum

Converting between Binary and Decimal Example 1:


1110 = 10112

Example 2:
2110 = 101012

10

Octal Number System


The Octal system uses the number 8 as a base. The Octal system is represented by any of the following 8 digits: 08 through 78. Each Octal position represents or replaces three binary digits (bits).

11

Octal Number System


D e c im a l 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

O c ta l

10

11

12

13

14

15

16

17

20

EXAMPLE: 610 = 0068 1210 = 0148 1910 = 0238 2610 = 0328

12

Hexadecimal Notation
Binary system is good for computers, but not convenient for human beings.
10110111 10100101 11010001 00110101

The conversion between binary system and decimal system is tedious. Computer professionals are used to use a compact notation
Hexadecimal notation

13

Hexadecimal Notation
uses the number 16 as a base. The Hexadecimal system is represented by any of the following 16 digits: 016 through 916, and A16 through F16 corresponding to decimal numbers 10 to15.

14

Hexadecimal Notation
Binary digits are grouped into sets of four, so there are 16 hexadecimal digits.

0000 = 0 0001 = 1 0010 = 2 0011 = 3

0100 = 4 0101 = 5 0110 = 6 0111 = 7

1000 = 8 1001 = 9 1010 = A 1011 = B

1100 = C 1101 = D 1110 = E 1111 = F


15

Conversion from Decimal to Binary and Hexadecimal Numbers


dividing the decimal number by the radix or base of the system you are converting to.
The following definitions identify the basic terms used in division: DIVIDEND-The number to be divided DIVISOR-The number by which a dividend is divided QUOTIENT-The number resulting from the division of one number by another REMAINDER-The final undivided part after division that is less or of a lower degree than the divisor

16

Conversion from Decimal to Binary and Hexadecimal Numbers


Example: Convert 610 to binary Step1: 62=3r0 Step2: 32=1r1 Step3: 12=0r1 Binary Equivalent: 1102

17

Conversion from Decimal to Binary and Hexadecimal Numbers


Example: Convert 0.375 to its binary equivalent: 0.375 X 2 0.750 0.750 x 2 1.500 0.500 x 2 1.000 0.000 x 2 0.000

18

Therefore 0.37510 is equal to 0. 0112

Conversion from Decimal to Binary and Hexadecimal Numbers

Example: Convert 28710 to hex Step1: 287 16 = 17 r 15 Step2: 17 16 = 1 r 1 Step3: 1 16 = 0 r 1

Therefore, 28710 is equal to 11F16.

19

Conversion from Binary to Decimal Numbers


To convert a base 2 numbers to base 10, you must know the decimal equivalent of each power of 2. The decimal value of a power of 2 is obtained by multiplying 2 by itself the number of times indicated by the exponent for whole numbers; for example, 24 = 2 x 2 x 2 x 2 or 1610. For fractional numbers, the decimal value is equal to 1 divided by 2 multiplied by itself the number of times indicated by the exponent; for example, 2-3 = 1 / (2x2x2) = 0.125.
20

Conversion from Binary to Decimal Numbers


25 32 24 16 23 8 22 4 21 2 20 . 1 . 2-1 0.5 2-2 0.25 2-3 0.125 2-4 0.0625

Radix Point

To convert a binary number to decimal by using the positional notation method; Step 1Write out the number to be converted; then, write in the decimal equivalent for each position with a 1 indicated. Step 2Add these values to determine the decimal equivalent of the binary number.

21

Conversion from Binary to Decimal Numbers


25 32 24 16 23 8 22 4 21 2 20 . 1 . 2-1 0.5 2-2 0.25 2-3 0.125 2-4 0.0625

Radix Point
E x a m p le : C o n v e r t 1 0 1 1 0 . 0 1
2

t o d e c im a l.

P r o b le m :

0 8

1 4

1 2

0. 1

0 0 .5

D e c im a l: 1 6 V a lu e :

0 .2 5 0 .2 5 2 4 + 16 2 2 .2 5
10

T h e re fo re 1 0 1 1 0 .0 1

is e q u a l t o 2 2 . 2 5

10.

Take

n o te

th a t th e

a n s w e r m a y s im p ly

be

w r it t e n

a s 2 2 . 2 5 . D e c im a l n u m b e r s c a n

be

w r it t e n w it h o u t in c lu d in g t h e b a s e .

22

Conversion from Binary to Hexadecimal Numbers


B in a r y H e x a d e c im a l 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7

B in a r y H e x a d e c im a l

1000 8

1001 9

1010 A

1011 B

1100 C

1101 D

1110 E

1111 F

Step 1 Starting at the radix point and moving either right or left, break the number into groups of four. The grouping of binary into four bit groups is called binary-coded hexadecimal (BCH).

Step 2Convert each group of binary numbers into its hexadecimal equivalent.
23

Conversion from Binary to Hexadecimal Numbers


B in a r y H e x a d e c im a l 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7

B in a r y H e x a d e c im a l

1000 8

1001 9

1010 A

1011 B

1100 C

1101 D

1110 E

1111 F

E x a m p le : C o n v e r t 1 1 1 0 1 0 0 1 1 . 1 1 1 R a d ix P o in t

to h e x .

0001

1101

0011.

1110

3.

16

T h e re fo re 1 1 1 0 1 0 0 1 1 .1 1 1

is e q u a l t o 1 D 3 . E

16.

24

Conversion from Hexadecimal to Binary Numbers


To convert a hex number to binary,
Step 1 Set up the number in the block format you used in binary to hex conversions. Step 2 Below each hex digit, write the fourdigit binary equivalent.
E x a m p le : C o n v e r t A C E
16

t o b in a r y .

16

1010

1100

1110

T h e re fo re A C E

16

is e q u a l t o 1 0 1 0 1 1 0 0 1 1 1 0

2.

25

Conversion from Hexadecimal to Decimal Numbers


To convert a hex number to decimal,
Step 1 write the propositional values or weights above each digit in the hexadecimal number. Step 2 multiply each digit by its positional value and add them all together. Example: Convert B49F16 to decimal. 163 162 161 160 4096 256 16 1 B 4 9 F x 11 x 4 x 9 x15 45056 + 1024 + 144 + 15 = 46,239 Therefore B49F16 is equal to 46,239.
26

Converting between Binary and Hexadecimal Much easier now! 10110111 10100101 11010001 00110101
B 7 A (B7A5D135)16 5 D 1 3 5

27

ASCII: American Standard Code for Information Interchange


Question: How does a computer represent characters?
Remember that a computer can only store digits of 0 and 1

ASCII specifies a correspondence between digital bit patterns and the symbols of a written language.
Digital bit patterns are those stored inside the computer Symbols are those shown to users, like a, Y, 8, etc.

Each ASCII character occupies one byte


33 non-printing control characters 95 printable characters
!"#$%&'()*+,-./0123456789:;<=>? @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ `abcdefghijklmnopqrstuvwxyz{|}~
28

Table of ASCII Code

29

Byte
A single bit has two states: 0 or 1 One byte = 8 binary bits = 2 hexadecimal digits
A byte is also called an octet

One byte has 256 states:


00000000, 00000001, 00000010, 00000011, 00000100, 00000101, 00000110, 00000111, 11111100, 11111101, 11111110, 11111111

Two bytes (16 bits) can have 216 = 65,536 states Four bytes (32 bits) can have 232=4,294,967,296 states

30

Computer Data Storage Unit, Byte


Computers store information in the form of 1 and 0's which is called bit. All information, text, numbers, audio, video etc are converted into 1 and 0's and stored in different types of storage in order to be processed by computer CPU. The most of common unit of storage is expressed as byte which is 8 bits. Computer data storage devices can be many types. RAM (Random Access Memory) is an example of primary data storage that can be accessed directly by CPU. This is fast but also limited in capacity. Data can be stored in many devices such as CDs, DVDs, Flash Drives, or big capacity tertiary storages which involves a robotic mechanism Although computer data is expressed as bytes, kilobytes, megabytes as it is in metric system, 1 kilobyte is 1024 bytes not 1000 bytes, as 1 megabyte is 1024 kilobytes not 1000 kilobytes.
31

Computer Data Storage Conversion


Binary prefixes, used commonly in computing and data capacity description, are based on power of two. Prefix Symbol Base 2 Kilo k 210 Mega M 220 Giga G 230 Tera T 240 Bigger then a terabyte is petabyte. Petabyte is equal 1024 terabytes Peta P 250 Value 1 024 1 048 576 1 073 741 824 1 099 511 627 776

1 125 899 906 842 624


32

File Size Conversion Table

33

You might also like