Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMS 161 Introduction to Computing

Similar presentations


Presentation on theme: "COMS 161 Introduction to Computing"— Presentation transcript:

1 COMS 161 Introduction to Computing
Title: Digital Numbers Date: February 7, 2005 Lecture Number: 12

2 Announcements Test next (not this) Wednesday First draft of paper
Due 2/11/05

3 Review Numbers Signed numbers Two’s complement numbers

4 Outline Numbers Numeric representation of letters Hexadecimal
Binary to hexadecimal conversion Hexadecimal to binary conversion Binary Coded Decimal (BCD)

5 Digital Letters Digital system All entities are represented as numbers
How do we represent the letters in the English language The letters form a discrete set (unique unambiguous, precise) No sampling is needed Simply need a mapping from each letter to a numerical representation A = 65 B = 66

6 Digital Letters Important that all converters use the same mapping
Otherwise the inverse process (converting a number to a letter) would give incorrect results Computers in the US primarily use the American Standard Code for Information Interchange (ASCII) Unicode is an international standard Compatible but extends the ASCII standard

7 ASCII mapping How many bits will I need to encode the letters of the English alphabet? Upper case Lower case Decimal digits Punctuation Arithmetic symbols Printer control characters

8 ASCII mapping Letters in the English language A = 6510 = 0100 00012
B = 6610 = Z = 9010 = a = 9710 = z = = Numbers are still left over for punctuation

9 ASCII Table

10 Binary number system Precision
The number of bits used to represent an item Letter: precision of 8 bits Integer (whole number): precision of 32 or 64 bits Always finite Computers have finite precision Presents some limitations

11 Hexadecimal number system
Sometimes called hex Positional, base-16 system Each digit is multiplied by a power of 16 Sixteen unique symbols (digits) 0, 1, 2, …, 15 Symbol a or A for 10 Symbol b or B for Symbol e or E for 14 Symbol c or C for Symbol f or F for 15 Symbol d or D for 13

12 Hexadecimal number system
A hex number can represent 16 different items Equivalent to 4 bits Makes it easy to convert between binary and hex Group bits by 4’s from the right end Substitute the hex symbol 9010 = = 5A16 Is the base 16 really needed? 6610 = = 4216

13 Hexadecimal number system
Use the backwards conversion to convert hex to binary One hex digit is equivalent to 4 bits Substitute the binary nibble Always start at the right end Add zeros to the left end as necessary to fill in 4 bits

14 Hexadecimal number system
BIN 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 10 1010 B 11 1011 C 12 1100 D 13 1101 E 14 1110 F 15 1111

15 Hexadecimal to decimal conversion
Same procedure as converting a binary number to a decimal number The digits of the hex number are the coefficients of the corresponding positional weighting factor ABC16 = 0xABC = A * B * C * 160 = A * B * 16 + C * 1 = 10 * * * 1 = =

16 Digitization The process of converting analog information into binary
Discrete forms are unambiguous Text and numbers are discrete Conversion of discrete to digital Come up with a mapping As we did with the letters

17 Binary Coded Decimal Integers (whole numbers)
One mapping is to use its binary equivalent Binary Coded Decimal (BCD) 010 = 00002 110 = 00012 910 = 10012 Need a minimum of 4 bits to represent 10 different values Some 4 bit quantities are wasted

18 Binary Coded Decimal String of decimal digits
Each decimal digit is represented by 4 bits The number of bits needed to represent different numbers vary Performing arithmetic is complicated Why? 15910 =


Download ppt "COMS 161 Introduction to Computing"

Similar presentations


Ads by Google