1
Chapter
2
Number system and Data
representation

2
Learning outcomes
By the end of this Chapter you will be able to:
•
Explain how integers are represented in computers using:
•
Unsigned, signed magnitude, one’s complement and two’s complement
notations
•
Explain how fractional numbers are represented in computers
•
Fixed point and Floating point notation
•
Explain how characters are represented in computers
•
E.g. using ASCII and Unicode
•
Explain how colours, images, sound and movies are represented

3
2.1 introduction
Binary number is simply a number comprised of only 0's and 1's.
Computers use binary numbers because it's easy for them to communicate using electrical
current
-- 0 is off, 1 is on.
A
bit
is the most basic unit of information in a computer.
•
It is a state of “on” or “off” in a digital circuit.
•
Sometimes they represent
high
or
low
voltage
A
byte
is a group of eight bits.. It is the smallest possible
addressable
unit of computer
storage
A
word
is the number of bits (word length) whichcan be processed by a computer in a
single step (e.g., 16,32 or 64)
The word size in any given computer is fixed.
Example
: 16-bit word
⇒
every word (memory location) can hold a 16-bit pattern, with each bit either 0 or 1.

2.2 Number systems
Base
or
Radix
r
system
: uses distinct symbols for
r digits
•
Most common number system :Decimal, Binary, Octal,
Hexadecimal
•
Decimal System/Base-10 System
•
Composed of 10 symbols or numerals(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0)
•
Binary System/Base-2 System
•
Composed of 10 symbols or numerals(0, 1)
•
Bit
= Binary digit
•
Hexadecimal System/Base-16 System :
•
Composed of 16 symbols or numerals(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C,
D, E, F)
•
Positional-value(weight) System :
r
2
r
1
r
0
.r
-1
r
-2
r
-3
•
Multiply each digit by an integer power of r and then form
the sum of all weighted digits
4

2.3 Conversion of number system
•
Binary-to-Decimal Conversions
1011.101
2
=
(1 x 2
3
) + (0 x 2
2
)+ (1 x 2
1
) + (1 x 2
o
) + (1 x 2
-1
) + (0 x 2
-2
) + (1 x 2
-3
)
=
8
10
+ 0 + 2
10
+ 1
10
+ 0.5
10
+ 0 + 0.125
10
=
11.625
10
•
Decimal-to-Binary Conversions
integer use Repeated division
37 / 2 =
18
remainder 1 (binary number will end with 1) :
LSB
18 / 2 =
9
remainder 0
9 / 2 =
4
remainder 1
4 / 2 =
2
remainder 0
2 / 2 =
1
remainder 0
1 / 2 =
0
remainder 1 (binary number will start with 1) :
MSB
Read the result upward to give an answer of
37
10
=
100101
2
5
Fraction use multiplication
0.375 x 2 = 0.750
integer
0
MSB
0.750 x 2 = 1.500
integer
1
.
0.500 x 2 = 1.000
integer
1
LSB
Read the result downward
.375
10
=
.011
2

6
Hex-to-Decimal Conversion
2AF
16
=
(2 x 16
2
) + (10 x 16
1
) + (15 x 16
o
)
=
512
10
+
160
10
+ 15
10
=
687
10
Decimal-to-Hex Conversion
423
10
/ 16 =
26
remainder
7 (Hex number will end with 7) : LSB
26
10
/ 16 =
1
remainder 10
1
10
/ 16 =
0
remainder 1 (Hex number will start with 1) : MSB
Read the result upward to give an answer of
423
10
=
1A7
16
Hex-to-Binary Conversion
9F2
16
=
9
F
2
= 1001
1111
0010
= 100111110010
2
Table 3-2
Hex
Binary
Decimal
0
0000
0
1
0001
1
2
0010
2
3
0011
3
4
0100
4
5
0101
5
6
0110
6
7
0111
7
8
1000
8
9
1001
9
A
1010
10
B
1011
11
C
1100
12
D
1101
13
E
1110
14
F
1111
15
Binary-to-Hex Conversion
1 1 1 0 1 0 0 1 1 0
2
=
0 0
0 0 1 1
1 0 1 0
0 1 1 0
3
A
6
=
3A6
16

7
2.4 Number representation
Representing whole numbers(integer )
Representing fractional numbers

8
2.4.1 Integer Representations
•
Unsigned notation
•
Signed magnitude notion
•
One’s complement notation
•
Two’s complement notation.

#### You've reached the end of your free preview.

Want to read all 49 pages?

- Fall '19
- Binary numeral system, Decimal, mantissa