1.4 + 1.5. representing text each of different symbol on the text (alphabet letter) is assigned a...

26
1.4 + 1.5

Upload: earl-foster

Post on 27-Dec-2015

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

1.4 + 1.5

Page 2: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Representing textRepresenting text

• Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns

• the text is then representing as a long string of bits.– ASCII” American standard code for information interchange”:

Uses patterns of 7-bits to represent most symbols used in written English text.

– Today, it is extended to 8-bits.

Islamic University Of Gaza, Nael Aburas 2

Page 3: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Figure 1.13 The message “Hello.” in Figure 1.13 The message “Hello.” in ASCIIASCII

Islamic University Of Gaza, Nael Aburas 3

Page 4: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Representing Text:

• The American National Standards Institute (ANSI) adapted the American Standard Code for Information Interchange (ASCII)

• This code uses 7 bits to represent the alphabets (a-z

& A-Z) and numbers from 0 to 9 and punctuation symbols.

Page 5: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Unicode:

• This code uses 16 bits represents each symbols.

• Unicode consists of 65536 different bit patterns enough to allow text written in such languages

• A file containing a long sequence of symbols encoded using ASCII or Unicode is often called a text file

Page 6: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Representing textRepresenting text

• Unicode: Uses patterns of 16-bits to represent the major symbols used in languages world side

• ISO standard: Uses patterns of 32-bits to represent most symbols used in languages world wide

Islamic University Of Gaza, Nael Aburas 6

Page 7: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

The difference between word processors and text file as follows:

Text file Word processors

1Use text editor Use word application

2Contains only character-by-

character encoding of text

Contains numbers proprietary codes representing changes in fonts, alignment information, …etc

3Use ASCII or Unicode Use proprietary code rather than the ASCII or Unicode

Page 8: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Representing Numeric ValuesRepresenting Numeric Values

• Binary notation is a way of representing numeric values using only digits 0 and 1.

Islamic University Of Gaza, Nael Aburas 8

Page 9: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Representing Numeric ValuesRepresenting Numeric Values

• A number can be represented differently in different systems. For example, the two numbers (2A)16 and (52)8 both refer to the same quantity, (42)10, but their representations are different.

• Each number system is associated with a base

Islamic University Of Gaza, Nael Aburas 9

Page 10: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Representing Numeric ValuesRepresenting Numeric Values

• A number represented as:

• Each digit carries a certain weight based on its position

Integer Fraction

Islamic University Of Gaza, Nael Aburas 10

Page 11: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Binary systemBinary system

• In the binary system, there are only two symbols or possible digit values, 0 and 1. This base-2 system can be used to represent any quantity that can be represented in decimal or other number system

Islamic University Of Gaza, Nael Aburas 11

Page 12: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Binary systemBinary system

• For example, here is (11001)11001)22 in binary

• (101.11)(101.11)22

Islamic University Of Gaza, Nael Aburas 12

Page 13: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

DecimalDecimal

• The decimal system is composed of 10 numerals or symbols. These 10 symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9; using these symbols as digits of a number, we can express any quantity.

• The decimal system, also called the base-10 system

Islamic University Of Gaza, Nael Aburas 13

Page 14: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Decimal systemDecimal system

• (224)(224)1010

• Note that the digit 2 in position 1 has the value Note that the digit 2 in position 1 has the value 20, but the same digit in position 2 has the 20, but the same digit in position 2 has the value 200value 200

Islamic University Of Gaza, Nael Aburas 14

Page 15: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Figure 1.15 The base ten and binary Figure 1.15 The base ten and binary systemssystems

Islamic University Of Gaza, Nael Aburas 15

Page 16: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Figure 1.16 Decoding the binary representation Figure 1.16 Decoding the binary representation 100101100101

Islamic University Of Gaza, Nael Aburas 16

Page 17: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

ExerciseExercise

• Convert each of the following binary representation to its base ten:–0101–1001–1011–0110–1000–10010

Islamic University Of Gaza, Nael Aburas 17

Page 18: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Figure 1.17 An algorithm for finding the Figure 1.17 An algorithm for finding the binary representation of a positive integerbinary representation of a positive integer

Islamic University Of Gaza, Nael Aburas 18

Page 19: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Figure 1.18 Applying the algorithm in Figure 1.18 Applying the algorithm in Figure 1.15 to obtain the binary Figure 1.15 to obtain the binary

representation of thirteenrepresentation of thirteen

Islamic University Of Gaza, Nael Aburas 19

Page 20: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Binary additionBinary addition

• To add two integers represented in binary notation, we follow the same procedure in the traditional base ten except that all sums are computed using the following addition fact.

Islamic University Of Gaza, Nael Aburas 20

Page 21: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Binary additionBinary addition

Islamic University Of Gaza, Nael Aburas 21

Page 22: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Binary additionBinary addition

Islamic University Of Gaza, Nael Aburas 22

Page 23: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Binary additionBinary addition

Islamic University Of Gaza, Nael Aburas 23

Page 24: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Fraction in binaryFraction in binary

• The digit to the right of radix point represent the fractional part.

• The positions are assigned fractional quantities

• The first position is assigned the quantity ½ (which is 2-1), and so on

Islamic University Of Gaza, Nael Aburas 24

Page 25: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Fraction in binaryFraction in binary

Islamic University Of Gaza, Nael Aburas 25

Page 26: 1.4 + 1.5. Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as

Decimal fraction to binaryDecimal fraction to binary

• Covert 0.625 to base 2625 x 2 = 1.25

.625 = .1

25 x 2 = 0.50

.625 = .10

.50 x 2 = 1.00

.625 = .101

Islamic University Of Gaza, Nael Aburas 26