Fundamentals of Programming (C) Group 7 Lecturer: Mahdi Soltani - - PowerPoint PPT Presentation

fundamentals of programming c
SMART_READER_LITE
LIVE PREVIEW

Fundamentals of Programming (C) Group 7 Lecturer: Mahdi Soltani - - PowerPoint PPT Presentation

Fundamentals of Programming (C) Group 7 Lecturer: Mahdi Soltani Lecture 3 Number Systems Sharif University of Technology Department of Computer Engineering Number Systems Lecture 3 Outline Numeral Systems Computer Data Storage


slide-1
SLIDE 1

Lecturer: Mahdi Soltani

Sharif University of Technology

Department of Computer Engineering

Fundamentals of Programming (C)

Group 7

Lecture 3 Number Systems

slide-2
SLIDE 2

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

2/52

Outline

  • Numeral Systems
  • Computer Data Storage Units
  • Numeral Systems Conversion
  • Calculations in Number Systems
  • Signed Integer Representation
  • Fractional and Real Numbers
  • ASCII Codes
slide-3
SLIDE 3

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

3/52

Numeral Systems

  • Decimal number system (base 10)
  • Binary number system (base 2)

– Computers are built using digital circuits – Inputs and outputs can have only two values: 0 and 1

  • 1 or True (high voltage)
  • 0 or false (low voltage)

– Writing out a binary number such as 1001001101 is tedious, and prone to errors

  • Octal and hex are a convenient way to represent binary numbers, as

used by computers

– Octal number system (base 8) – Hexadecimal number system (base 16)

slide-4
SLIDE 4

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

4/52

Numeral Systems

Hexadecimal Octal Binary Decimal 1 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 9 9 A (decimal value of 10) B (decimal value of 11) C (decimal value of 12) D (decimal value of 13) E (decimal value of 14) F (decimal value of 15)

Base B : 0 ≤ digit ≤ B -1

  • Base 10 : 0 ≤ digit ≤ 9 (10 -1)

Base 2 : 0 ≤ digit ≤ 1 (2-1) Base 8 : 0 ≤ digit ≤ 7 (8 -1) Base 16 : 0 ≤ digit ≤ 15 (16 -1)

slide-5
SLIDE 5

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

5/52

Computer Data Storage Units

  • Bit

– Each bit can only have a binary digit value: 1 or 0 – basic capacity of information in computer – A single bit must represent one of two states: 21=2

  • How many state can encode by N bit?

1 OR

slide-6
SLIDE 6

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

6/52

Binary Encoding

1 1 1 1 2 1 1 3 1 2 1 1 1 2 1 1 3 1 4 1 1 5 1 1 6 1 1 1 7

1 2 3 1 1 1 2 1 1 3 1 4 1 1 5 1 1 6 1 1 1 7 1 8 1 1 9 1 1 10 1 1 1 11 1 1 12 1 1 1 13 1 1 1 14 1 1 1 1 15

1 1

slide-7
SLIDE 7

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

7/52

Computer Data Storage Units

  • Byte: A sequence of eight bits or binary digits

– 28 = 256 (0..255) – smallest addressable memory unit

1 2 3 4 5 6 7 1 1 1 2 1 1 3 … … … … … … … … …

Bit Order One Bit Memory Address 1 2 3 …

slide-8
SLIDE 8

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

8/52

  • Kilo byte: 2 10 b = 1024 b ~ 103 b
  • 2 11 = 21 x 210 = 2 KB = 2048 b
  • 2 16 = 26 x 210 = 64 KB = 65536 b
  • Mega byte: 2 20 b = 1024 × 1024 b
  • 2 21 = 21 x 220 = 2 M
  • Giga byte: 2 30
  • ….

Computer Data Storage Units

slide-9
SLIDE 9

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

9/52

Numeral Systems Conversion

 Convert from Base-B to Base-10:

  • (A) B = (?) 10
  • (4173)10 = (4173)10
  • (11001011.0101)2 = (?)10
  • (0756)8 = (?)10
  • (3b2)16 = (?)10

 Convert from Base-10 to Base-B:

  • (N) 10 = (?) B
  • (4173) 10 = (?)2
  • (494) 10 = (?)8
  • (946) 10 = (?)16
slide-10
SLIDE 10

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

10/52

Convert from Base-B to Base-10

  • 1. Define bit order
  • Example : Base-2 to Base-10

... 3

  • 2
  • 1
  • 1

2 3 4 5 6 7 .. .

  • 4

3

  • 2
  • 1
  • 1

2 3 4 5 6 7 1 1 . 1 1 1 1 1

slide-11
SLIDE 11

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

11/52

Convert from Base-B to Base-10

  • 2. Calculate Position Weight

– B bit order

  • Example : Base-2 to Base-10

2-4 2-3 2-2 2 1

  • 20

21 22 23 24 25 26 27

  • 4

3

  • 2
  • 1
  • 1

2 3 4 5 6 7 1 1 . 1 1 1 1 1

B = 2 … Position Weight Decimal Point

102 101 100 10-1 10-2 100s 10s 1s 1/10s 1/100s 9 8 7 . 5 6

slide-12
SLIDE 12

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

12/52

Convert from Base-B to Base-10

  • 3. Multiplies the value of each digit by the value
  • f its position weight

0.0625 0.125 0.25 0.5 1 2 4 8 16 32 64 128

  • 4

3

  • 2
  • 1
  • 1

2 3 4 5 6 7 1 1 . 1 1 1 1 1 0.0625 * 1 0.125 * 0.25 * 1 0.5 * 1 * 1 2 * 1 4 * 8 * 1 16 * 32 * 64 * 1 128 * 1 0.0625 0.25 . 1 2 8 64 128

*

slide-13
SLIDE 13

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

13/52

Convert from Base-B to Base-10

  • 4. Adds the results of each section

0.0625 0.125 0.25 0.5 1 2 4 8 16 32 64 128

  • 4

3

  • 2
  • 1
  • 1

2 3 4 5 6 7 1 1 . 1 1 1 1 1 0.0625 * 1 0.125 * 0.25 * 1 0.5* 1 * 1 2 * 1 4 * 8 * 1 16 * 32 * 64 * 1 128 * 1 0.0625 0.25 . 1 2 8 64 128

203 + 0.3125 203.3125

slide-14
SLIDE 14

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

14/52

Convert from Base-B to Base-10

  • Examples:

(a n-1 a n-2 … a 0 . a -1 … a -m ) B = (N)10 N = (a n-1 * B n-1) + (a n-2 * B n-2) + … + (a 0 * B 0) + (a -1 * B -1) + … + (a -m * B –m)

  • (4173)10 = (4 * 103) + (1 * 102) + (7*101) + (3*100) = (4173)10
  • (0756)8 = (0 * 83) + (7 * 82) + (5*81) + (6*80) = (494)10
  • (3b2)16 = (3 * 162) + (11*161) + (2*160) = (946)10
  • (2E6.A3)16 = (2 * 162) + (14*161) + (6*160) +

(10 * (1 / 16)) + (3 * (1 / (16 * 16))) = (?)10

16 -1 16 -2

slide-15
SLIDE 15

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

15/52

Convert from Base-10 to Base-B

  • (N)10 = ( a n-1 a n-2 … a 0 . a -1 … a -m ) B

Integer part Fraction part

  • 1. Convert integer part to Base-B

– Consecutive divisions

  • 2. Convert fraction part to Base-B

– Consecutive multiplication

25.125 25 0.125

slide-16
SLIDE 16

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

16/52

Convert Integer Part to Base-B

  • Repeat until the quotient reaches 0
  • Write the reminders in the reverse order

– Last to first

  • Examples:

2 25 2 12 24 2 6 12 1 2 3 6 2 1 2 1 1

( 25 )10 = (11001) 2

slide-17
SLIDE 17

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

17/52

Convert Integer Part to Base-B

  • Examples:

8

494 8 61 488 8 7 56 6 5 7

(494)10 = (756)8

16 946 16 59 944 16 3 48 2 11 3

(946)10 = (3B2)16

slide-18
SLIDE 18

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

18/52

Convert Fraction Part to Base-B

  • Do
  • multiply fraction part by B (the result)
  • drop the integer part of the result (new fraction)
  • While
  • (result = 0) OR (reach to specific precision)
  • the integral parts from top to bottom are

arranged from left to right after the decimal point

slide-19
SLIDE 19

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

19/52

Convert Fraction Part to Base-B

  • Example:
  • 0.125 * 2 = 0.25
  • 0.25 * 2 = 0.50 (0.125)10 = (0.001)2
  • 0.50 * 2 = 1.00
  • 0.00 * 2 = 0.00

1.00

slide-20
SLIDE 20

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

20/52

Convert Fraction Part to Base-B

  • Example:

– 0.6 * 2 = 1.2 – 0.2 * 2 = 0.4 (0.6)10 = (0.1001)2 – 0.4 * 2 = 0.8 – 0.8 * 2 = 1.6 – 0.6 * 2 = …

slide-21
SLIDE 21

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

21/52

Conversion binary and octal

  • Binary to Octal
  • 23 = 8
  • Each digit in octal format: 3 digits in binary format
  • If the number of digits is not dividable by 3, add

additional zeros:

  • 43 = 043 = 000043 = 043.0 = 043.000
  • (10011.1101) 2 = (010011.110100) 2 = (23.64) 8

2 3 6 4

a3 a2 a1 a0

.

a-1 a-2

Octal 1 2 3 4 5 6 7 Binary 000 001 010 011 100 101 110 111

slide-22
SLIDE 22

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

22/52

Conversion binary and octal

  • Octal to Binary
  • Substitute each digit with 3 binary digits
  • (5)8 = (101)2
  • (1)8 = (001)2
  • (51)8 = (101 001)2
  • (23.61) 8 = (010 011.110 001) 2
slide-23
SLIDE 23

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

23/52

Conversion binary and Hexadecimal

  • Binary to Hexadecimal
  • 24 = 16
  • Each digit in octal format: 4 digits in binary format
  • If the number of digits is not dividable by 4, add

additional zeros:

  • (1111101.0110) 16 = (01111101.0110) 16 = (7D.6) 2

7 D 6

a3 a2 a1 a0

.

a-1 a-2

slide-24
SLIDE 24

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

24/52

Conversion binary and Hexadecimal

  • Hexadecimal to Binary
  • Substitute each digit with 4 binary digits
  • (F25.03) 16 = (1111 0010 0101.0000 0011) 2

1111 0010 0101 . 0000 0011

slide-25
SLIDE 25

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

25/52

Conversion

  • Octal binary Hexadecimal
  • (345) 8 = (E5) 16
  • (345) 8 = (011100101) 2 = (011100101) 2 = (E5) 16

3 4 5 E 5

  • (3FA5) 16 = (0011111110100101) 2 =

(0011111110100101) 2 = (037645) 8 = (37645) 8

slide-26
SLIDE 26

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

26/52

Calculations in Numeral Systems

  • Addition
  • Binary

1 1 1 1 carried digits (13)10 1 1 0 1 (23)10 1 0 1 1 1 (36)10 1 0 0 1 0 1 + 1 → 1 0 1 + 1 + 1 → 1 1 1 1 1 1 1 1 0 1 1 (1 + 1 ) 10 → (2) 10 = (10) 2

slide-27
SLIDE 27

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

27/52

Calculations in Numeral Systems

  • Addition
  • Hexadecimal
  • Octal

4 5 6 7 8 4 B D A 1 1 7 8 4 B D A 1 B 5 E (8 + D ) 16 → (8 + 13) 10 = (21) 10 = (15) 16 1 1 1 1 1 7 7 7 1 4 7 6 1 0 1 2 (4 + 6 ) 10 → (10) 10 = (12) 8

slide-28
SLIDE 28

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

28/52

Calculations in Numeral Systems

  • Subtraction
  • Binary

2 0 2 Borrowed digits (13)10 1 1 0 1 (7)10 1 1 1 (6)10 0 1 1 (2) 10 = (10) 2 1 1 1 1 1 1 Borrowed digit

slide-29
SLIDE 29

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

29/52

Calculations in Numeral Systems

  • Subtraction
  • Hexadecimal
  • Octal

16 + 0 = 16 16 + 3 = 19 2 3 5 + 16 =21 3 1 4 5 1 9 7 6 1 7 C F 3 6+ 8 = 14 4 6 7 3 7

slide-30
SLIDE 30

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

30/52

Signed Integer Representation

  • Negative numbers must be encode in binary

number systems

  • Well-known methods

– Sign-magnitude – One’s Complement – Two’s Complement

  • Which one is better?

– Calculation speed – Complexity of the computation circuit

slide-31
SLIDE 31

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

31/52

Sign-magnitude

  • One sign bit + magnitude bits

– Positive: s = 0 – Negative: s= 1 – Range = {(-127)10 .. (+127) 10} – Two ways to represent zero:

  • 00000000 (+0)
  • 10000000 (−0)

– Examples:

  • (+ 43)10 = 00101011
  • (- 43)10 = 10101011
  • How many positive and negative integers can be represented using

N bits?

– Positive: 2 N-1 - 1 – Negative: 2 N-1 - 1

1 2 3 4 5 6 7

s Magnitude Sign

slide-32
SLIDE 32

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

32/52

Sign-magnitude

  • Signed magnitude representation is easy for

people to understand, but it requires complicated computer hardware.

  • Another disadvantage of signed magnitude is

that it allows two different representations for zero: positive zero and negative zero.

  • For these reasons (among others) computers

systems employ complement systems for numeric value representation.

slide-33
SLIDE 33

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

33/52

One’s Complement

  • For example, using 8-bit one’s complement

representation:

+ 3 is: 00000011

  • 3 is:

11111100

  • In one’s complement representation, as with signed

magnitude, negative values are indicated by a 1 in the high order bit.

  • Complement systems are useful because they

eliminate the need for subtraction. The difference of two values is found by adding the minuend to the complement of the subtrahend

slide-34
SLIDE 34

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

34/52

One’s Complement

  • With one’s complement

addition, the carry bit is “carried around” and added to the sum.

– Example: Using one’s complement binary arithmetic, find the sum of 48 and - 19

We note that 19 in binary is

00010011,

so -19 in one’s complement is:

11101100.

slide-35
SLIDE 35

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

35/52

One’s Complement

  • Although the “end carry around” adds some

complexity, one’s complement is simpler to implement than signed magnitude.

  • But it still has the disadvantage of having two

different representations for zero: positive zero and negative zero.

  • Two’s complement solves this problem.
  • Two’s complement is the radix complement of

the binary numbering system; the radix complement of a non-zero number N in base r with d digits is rd – N.

slide-36
SLIDE 36

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

36/52

Two’s Complement

  • Negative numbers:

1. Invert all the bits through the number

  • ~(0) = 1 ~(1) = 0

2. Add one

  • Example:
  • +1 = 00000001
  • - 1 = ?
  • ~(00000001) → 11111110
  • 11111110 + 1 → 11111111
  • Only one zero (00000000)
  • Range = {127 .. −128}
  • 1

1 1 1 1 1 1 1 1

  • 2

1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 Negative two's complement (11111101)

  • (00000011) = -3

~(11111101) + 1

slide-37
SLIDE 37

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

37/52

Two’s Complement

– Example: Using one’s complement binary arithmetic, find the sum of 48 and - 19.

  • With two’s complement arithmetic, all we do is add
  • ur two binary numbers. Just discard any carries

emitting from the high order bit.

We note that 19 in binary is:

00010011,

so -19 using one’s complement is:

11101100,

and -19 using two’s complement is: 11101101.

slide-38
SLIDE 38

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

38/52

38

  • When we use any finite number of bits to

represent a number, we always run the risk of the result of our calculations becoming too large

  • r too small to be stored in the computer.
  • While we can’t always prevent overflow, we can

always detect overflow.

  • In complement arithmetic, an overflow condition

is easy to detect.

Two’s Complement

slide-39
SLIDE 39

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

39/52

39

  • Example:

– Using two’s complement binary arithmetic, find the sum of 107 and 46.

  • We see that the nonzero carry

from the seventh bit overflows into the sign bit, giving us the erroneous result: 107 + 46 = -103.

But overflow into the sign bit does not always mean that we have an error.

Two’s Complement

slide-40
SLIDE 40

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

40/52

40

  • Example:

– Using two’s complement binary arithmetic, find the sum of 23 and

  • 9.

– We see that there is carry into the sign bit and carry out. The final result is correct: 23 + (-9) = 14.

Rule for detecting signed two’s complement overflow: When the “carry in” and the “carry out” of the sign bit differ,

  • verflow has occurred. If the carry into the sign bit equals the

carry out of the sign bit, no overflow has occurred.

Two’s Complement

slide-41
SLIDE 41

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

41/52

41

  • The signed magnitude, one’s complement,

and two’s complement representation that we have just presented deal with signed integer values only.

  • Without modification, these formats are not

useful in scientific or business applications that deal with real number values.

  • Floating-point representation solves this

problem.

Floating-Point representation

slide-42
SLIDE 42

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

42/52

42

  • If we are clever programmers, we can perform

floating-point calculations using any integer format.

  • This is called floating-point emulation, because

floating point values aren’t stored as such; we just create programs that make it seem as if floating- point values are being used.

  • Most of today’s computers are equipped with

specialized hardware that performs floating-point arithmetic with no special programming required.

Floating-Point representation

slide-43
SLIDE 43

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

43/52

43

  • Floating-point numbers allow an arbitrary

number of decimal places to the right of the decimal point.

– For example: 0.5  0.25 = 0.125

  • They are often expressed in scientific notation.

– For example: 0.125 = 1.25  10-1 5,000,000 = 5.0  106

Floating-Point representation

slide-44
SLIDE 44

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

44/52

44

  • Computers use a form of scientific notation for

floating-point representation

  • Numbers written in scientific notation have three

components:

Floating-Point representation

slide-45
SLIDE 45

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

45/52

45

  • Computer representation of a floating-point

number consists of three fixed-size fields:

  • This is the standard arrangement of these fields.

Note: Although “significand” and “mantissa” do not technically mean the same thing, many people use these terms interchangeably. We use the term “significand” to refer to the fractional part of a floating point number.

Floating-Point representation

slide-46
SLIDE 46

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

46/52

46

  • We introduce a hypothetical “Simple Model” to

explain the concepts

  • In this model:

– A floating-point number is 14 bits in length – The exponent field is 5 bits – The significand field is 8 bits

Floating-Point representation

slide-47
SLIDE 47

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

47/52

47

  • 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.

Floating-Point representation

slide-48
SLIDE 48

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

48/52

48

  • The IEEE has established a standard for

floating-point numbers

  • The IEEE-754 single precision floating point

standard uses an 8-bit exponent (with a bias of 127) and a 23-bit significand.

  • The IEEE-754 double precision standard uses

an 11-bit exponent (with a bias of 1023) and a 52-bit significand.

Floating-Point representation

slide-49
SLIDE 49

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

49/52

49

  • In both the IEEE single-precision and double-

precision floating-point standard, the significant has an implied 1 to the LEFT of the radix point.

– The format for a significand using the IEEE format is: 1.xxx… – For example, 4.5 = .1001 x 23 in IEEE format is 4.5 = 1.001 x

  • 22. The 1 is implied, which means is does not need to be

listed in the significand (the significand would include only 001).

Floating-Point representation

slide-50
SLIDE 50

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

50/52

50

  • Example: Express -3.75 as a floating point number using

IEEE single precision.

  • First, let’s normalize according to IEEE rules:

– 3.75 = -11.112 = -1.111 x 21 – The bias is 127, so we add 127 + 1 = 128 (this is our exponent) – The first 1 in the significand is implied, so we have: – Since we have an implied 1 in the significand, this equates to

  • (1).1112 x 2 (128 – 127) = -1.1112 x 21 = -11.112 = -3.75.

(implied)

Floating-Point representation

slide-51
SLIDE 51

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

51/52

ASCII Codes

  • American Standard Code for Information Interchange

– First decision: 7 bits for representation – Final decision: 8 bits for representation

  • 256 characters
  • ASCII (“P”) = (50) 16

ASCII (“=”) = (3D) 16

F E D C B A 9 8 7 6 5 4 3 2 1 Hexadecimal SI SO CR FF VT LF TAB BS BEL ACK ENQ EOT ETX STX SOH NUL US RS GS FS ESC SUB EM CAN ETB SYN NAK DC4 DC3 DC2 DC1 DLE 1 / .

  • ,

+ * ( ) ' & % $ # " ! 2 ? < = > ; : 9 8 7 6 5 4 3 2 1 3 O N M L K J I H G F E D C B A @ 4 _ ^ [ \ ] Z Y X W V U T S R Q P 5

  • n

m l k j i h g f e d c b a ` 6 ~ { | } z y x w v u t s r q p 7

row number column number

slide-52
SLIDE 52

Number Systems – Lecture 3

Sharif University of Technology

Department of Computer Engineering

52/52

Summary

  • Numeral Systems

– Decimal, Binary, Octal, Hexadecimal

  • Computer Data Storage Units

– Bit, Byte, Kilo byte, Giga byte,

  • Numeral Systems Conversion

– Convert between different bases

  • Calculations in Number Systems

– Addition and subtraction

  • Signed Integer Representation

– Sing-magnitude: one sign bit + magnitude bits – Two’s complement : (-N) = ~(N) + 1

  • Fractional and Real Numbers
  • ASCII Codes