Introduction to Computer Science Sem1
Introduction to Computer Science Sem1
16
Introduction
17
Number Systems
18
Number Systems
19
Number Systems
20
Decimal Binary Hexadecimal Octal
0 00000 0 0
1 0001 1 1
Decimal, 2 0010 2 2
Binary, 3
4
0011
0100
3
4
3
4
Hexadecimal, 5 0101 5 5
6 0110 6 6
Octal 7 0111 7 7
8 1000 8 10
9 1001 9 11
10 1010 A 12
11 1011 B 13
12 1100 C 14
13 1101 D 15
14 1110 E 16
15 1111 F 17
21
Converting decimal to binary
22
Converting binary to decimal
6 5 4 3 2 1 0
(1011011) 2=1 × 2 + 0 × 2 +1 × 2 +1 × 2 + 0 × 2 +1 × 2 +1 × 2
¿ (91)10
(10 + 0.11)2=1 × 2 1+ 0 × 20 +1 × 2− 1 +1 × 2− 2
¿ (2.75)10
23
Conversion of hexadecimal to decimal
¿ (7551)10
𝐻𝑒𝑥𝑎𝑑𝑒𝑐𝑖𝑚𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 =9 3 𝐹 𝐴
𝐵𝑖𝑛𝑎𝑟𝑦 𝑛𝑢𝑚𝑏𝑒𝑟 =1001 0011 1111 1010
26
Floating-Point Representation
27
Floating-Point Representation
• Computer representation of a floating-point
number consists of three fixed-size fields:
Note: Although “significand” and “mantissa” do not technically mean the same thing, many people use these terms interchangeably. We use the
28
Floating-Point Representation
29
Floating-Point Representation
• Example:
– Express 3210 in the simplified 14-bit floating-point model.
• We know that 32 is 25. So in (binary) scientific notation
32 = 1.0 x 25 = 0.1 x 26.
– In a moment, we’ll explain why we prefer the second
notation versus the first.
• Using this information, we put 110 (= 610) in the
exponent field and 1 in the significand as shown.
30
Computer Architecture