DLD Lecture 03(Number conversion & arithmetic).pptx
alisyd730
10 views
30 slides
Oct 07, 2024
Slide 1 of 30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
About This Presentation
Number conversion & arithmetic
Size: 19.02 MB
Language: en
Added: Oct 07, 2024
Slides: 30 pages
Slide Content
Easy Approach: Numbering Systems And Arithmetic Operations On Hex, Binary, And Octal Lecture-03 Teacher: Dr. Syed Ali Asgher Email: [email protected]
2 12 Department of Computer Science
Exercise – Convert ... 3 Don’t use a calculator! Decimal Binary Octal Hexa- decimal 33 1110101 703 1AF Skip answer Answer Department of Computer Science
What is the two’s complement? A two's-complement system is a system in which negative numbers are represented by the two's complement of the absolute value. 5
Example Suppose we're working with 8 bit and suppose we want to find how -28 would be expressed in two's complement notation. First we write out 28 in binary form. 0 0 0 1 1 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 0 1 1 Then we invert the digits. 0 becomes 1, 1 becomes 0. Then we add 1. That is how one would write -28 in 8 bit binary. 6
7 An 8-bit unsigned integer number can represent the values 0 to 255. However for signed number a two's complement 8-bit number can only represent non-negative integers from 0 to 127, because the rest of the bit represent the negative integers −1 to −128. 2 8 = 256
Common Powers (1 of 2) Base 10 8 Power Preface Symbol 10 -12 pico p 10 -9 nano n 10 -6 micro 10 -3 milli m 10 3 kilo k 10 6 mega M 10 9 giga G 10 12 tera T Value .000000000001 .000000001 .000001 .001 1000 1000000 1000000000 1000000000000
Common Powers (2 of 2) Base 2 9 Power Preface Symbol 2 10 kilo k 2 20 mega M 2 30 Giga G Value 1024 1048576 1073741824 What is the value of “k”, “M”, and “G”? In computing, particularly w.r.t. memory , the base-2 interpretation generally applies.
10
Example 11 / 2 30 = 1. Double click on My Computer 2. Right click on C: 3. Click on Properties
Review – multiplying powers For common bases, add powers 12 2 6 2 10 = 2 16 = 65,536 or… 2 6 2 10 = 64 2 10 = 64k a b a c = a b+c