Unit 2 Representation of Information in Computers - Tin học đại cương (IT1110) | Trường Đại học Bách khoa Hà Nội

Unit 2 Representation of Information in Computers

lOMoARcPSD| 27879799
lOMoARcPSD| 27879799
2
. Number Systems
lOMoARcPSD| 27879799
3
. Number Systems
lOMoARcPSD| 27879799
4
lOMoARcPSD| 27879799
5
Decimal System
The system has ten as its base
Uses various symbols (called digits) for no more than ten
disnct values (0, 1, 2, 3, 4, 5, 6, 7, 8 and 9) to represent
any number
Decimal separator indicates the start of a fraconal part
Sign symbols + (posive) or (negave) in front of the
numbers to indicate sign
lOMoARcPSD| 27879799
6
If i is an integer wrien in decimal form with digits d
n-1
n-2
. . . . d
lOMoARcPSD| 27879799
7
= 112
n-1
n-2
. . . . d
*
lOMoARcPSD| 27879799
8
lOMoARcPSD| 27879799
9
value
value
Divide the result by
The result is
lOMoARcPSD| 27879799
10
lOMoARcPSD| 27879799
11
Convert Decimal Fracons to Base-b
Begin with the decimal fracon and mulply by b. The
whole number part of the result is the rst digit to the
right of the point.
Disregard the whole number part of the previous result
and mulply by b once again. The whole number part of
this new result is the second digit to the right of the
point.
lOMoARcPSD| 27879799
12
Connue this process unl you get a zero as numbers
decimal part or unl you recognize an innite repeang
paern.
lOMoARcPSD| 27879799
13
The representaon of .625
lOMoARcPSD| 27879799
14
lOMoARcPSD| 27879799
15
Binary System
All data, including programs, in a computer system is
represented in terms of groups of binary digits
A single bit can represent one of two values, 0 or 1.
If we have several symbols to represent, we can make a one-
to-one correspondence between the paerns and the
symbols.
Example : 0, 1, 2, 3 are mapped to the paerns 00, 01,
10, 11
A group of k binary digits (bits) can be used to represent 2
k
symbols
lOMoARcPSD| 27879799
16
lOMoARcPSD| 27879799
17
= 157. 8125
lOMoARcPSD| 27879799
18
Units of Informaon
Units of Informaon
lOMoARcPSD| 27879799
19
Basic Principles
Data can be numbers, symbols, images, sounds . . .
To store in computers, its necessary to represent data
in term of bit paerns
There are dierent ways to encode dierent types of
data
Numbers are convert to their binary representaons
following some standard. • Symbols are assigned a bit
paern
Other data must be digitalized.
lOMoARcPSD| 27879799
20
Images and Graphics
All of data is stored as binary digits: strings of 1s and 0s
| 1/65

Preview text:

lOMoAR cPSD| 27879799 lOMoAR cPSD| 27879799 . Number Systems 2 lOMoAR cPSD| 27879799 . Number Systems 3 lOMoAR cPSD| 27879799 4 lOMoAR cPSD| 27879799 Decimal System
• The system has ten as its base
• Uses various symbols (called digits) for no more than ten
distinct values (0, 1, 2, 3, 4, 5, 6, 7, 8 and 9) to represent any number
• Decimal separator indicates the start of a fractional part
• Sign symbols + (positive) or − (negative) in front of the numbers to indicate sign 5 lOMoAR cPSD| 27879799
If i is an integer written in decimal form with digits d n-1 . . . . d n-2 6 lOMoAR cPSD| 27879799 = 112 n-1 . . . . d n-2 * 7 lOMoAR cPSD| 27879799 8 lOMoAR cPSD| 27879799 value value Divide the result by The result is 9 lOMoAR cPSD| 27879799 10 lOMoAR cPSD| 27879799
Convert Decimal Fractions to Base-b
• Begin with the decimal fraction and multiply by b. The
whole number part of the result is the first digit to the right of the point.
• Disregard the whole number part of the previous result
and multiply by b once again. The whole number part of
this new result is the second digit to the right of the point. 11 lOMoAR cPSD| 27879799
• Continue this process until you get a zero as number’s
decimal part or until you recognize an infinite repeating pattern. 12 lOMoAR cPSD| 27879799 The representation of .625 13 lOMoAR cPSD| 27879799 14 lOMoAR cPSD| 27879799 Binary System
• All data, including programs, in a computer system is
represented in terms of groups of binary digits
• A single bit can represent one of two values, 0 or 1.
• If we have several symbols to represent, we can make a one-
to-one correspondence between the patterns and the symbols.
• Example : 0, 1, 2, 3 are mapped to the patterns 00, 01, 10, 11
• A group of k binary digits (bits) can be used to represent 2k symbols 15 lOMoAR cPSD| 27879799 16 lOMoAR cPSD| 27879799 = 157. 8125 17 lOMoAR cPSD| 27879799 Units of Information Units of Information 18 lOMoAR cPSD| 27879799 Basic Principles
• Data can be numbers, symbols, images, sounds . . .
• To store in computers, it’s necessary to represent data in term of bit patterns
• There are different ways to encode different types of data
• Numbers are convert to their binary representations
following some standard. • Symbols are assigned a bit pattern
• Other data must be digitalized. 19 lOMoAR cPSD| 27879799 Images and Graphics
All of data is stored as binary digits: strings of 1s and 0s 20