chapter 3 representing numbers and text in binary information technology in theory by pelin aksoy...

13
Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

Upload: cameron-quinn

Post on 11-Jan-2016

231 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

Chapter 3Representing Numbers and

Text in Binary

Information Technology in Theory

By Pelin Aksoy and Laura DeNardis

Page 2: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

2

Binary Coded Decimal

• Binary coded decimal (BCD) is a different approach

• Encodes each digit in the decimal number individually rather than converting the entire number

• To convert 30 to BCD, the 3 would first be converted into binary, and then 0 would be converted into binary

• Then the two binary strings would be concatenated (i.e. brought together) to represent the number 30

Information Technology in Theory

Page 3: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

3

Binary Coded Decimal (continued)

Information Technology in Theory

Page 4: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

4

BCD Example

Convert the decimal number 7244(10) into binary coded decimal

7 = 01112 = 00104 = 01004 = 0100

7244(10) = 0111001001000100(2) (BCD)

Information Technology in Theory

Page 5: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

5

BCD Example (continued)

Convert the sequence 0001100001111001 into decimal

First break the sequence into groups of four starting from right to left: 0001 1000 0111 1001

Then convert each group into decimal:0001(2) = 1(10)

1000(2) = 8(10)

0111(2) = 7(10)

1001(2) = 9(10)

The answer is 1879(10)

Information Technology in Theory

Page 6: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

6

Representing Text and Other Characters in Binary

• Binary code can represent text and alphanumeric characters

• Two standards: – ASCII – Unicode

Information Technology in Theory

Page 7: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

7

ASCII• Extended ASCII assigns an 8-bit code for each

alphanumeric character • Recall that an 8-bit code can represent 28, or 256,

unique items

Information Technology in Theory

Page 8: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

8

Segment of ASCII Chart

Information Technology in Theory

Page 9: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

9

ASCII Example

H = 01001000e = 01100101l = 01101100l = 01101100o = 01101111! = 100100001

Therefore, “Hello!” = 0100100001100101011011000110110001101111. The hexadecimal shorthand for this binary sequence is 48 65 6C 6C 6F 21

Information Technology in Theory

Page 10: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

10

Unicode

• Unicode is an important standard that uses 16 bits• Allows for a representation of 216 (more than

65,000) unique characters • Provides sufficient characters to encode many

different major languages (such as English, Arabic, and Chinese)

• Unicode charts may be found by visiting http://unicode.org

Information Technology in Theory

Page 11: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

11

EBCDIC

• Extended Binary Coded Decimal Interchange Code

• Standard associated with IBM computers

• Assigns 8 bits per character

• An extension of binary coded decimal

Information Technology in Theory

Page 12: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

12

Summary

• Bits can encode any type of information, including the decimal numbers we use in everyday life and alphanumeric text

• A real-world example of binary to decimal conversion is the unique Internet address– Encoded in dotted decimal format – Makes a long binary string easier for people to

read• You can also convert between binary and positive

integers and represent negative integer and positive noninteger numbers in binary

Information Technology in Theory

Page 13: Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis

13

Summary (continued)

• Alternative numbering systems are octal, which uses eight numbers, and hexadecimal, which uses 16 numbers– Not used by digital devices, but by people as a

shorthand convention – Network identification in local area networks is

usually represented in hexadecimal • Binary code also represents alphanumeric

characters – ASCII– Unicode– EBCDIC

Information Technology in Theory