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: January 26, 2005 Lecture Number: 7

2 Announcements Homework 2 Read the paper “The World Wide Web”
Be prepared to discuss it Why do sea-gulls fly over the sea? Because if they flew over the bay they would be bagels! A man left home running. He ran a ways and then turned left, ran the same distance and turned left again, ran the same distance and turned left again. When he got home there were two masked men. Who were they? A catcher and an umpire

3 Review Digital information Advantages Disadvantages

4 Outline Numbers Non-positional Positional Decimal Octal Hexadecimal
Definition Decimal Octal Hexadecimal Unsigned and signed numbers Binary Coded Decimal (BCD)

5 Digital Domain Converting analog to digital information
We need a digital representation of the information Recall, digital is a discrete system Where symbols are numbers The digital advantages Therefore, we need a numerical encoding of the data Numerical means numbers

6 Numbers Two types of notion used to represent numbers
Non-positional notation No special significance is given to order Counting numbers on your fingers Tick mark counting method The number of items is important, not the order My honey do list Not important which task I do first, just so I get them all done

7 Numbers Positional notation
Significance is given to order the digits appear in the number The decimal numbering system uses positional notation This is the system we use 365 is not the same a 653 These are completely different numbers They use the same digits

8 Positional notation 365 means
Three hundreds Six tens Five ones Each digit is multiplied by a power of 10

9 Decimal number system Synonyms
Decimal notation Base-10 system Both digits and their location in the number are important Ten unique symbols (digits) 0, 1, 2, …, 9

10 Octal number system Decimal is not the only positional number system available Octal Positional,base-8 system Each digit is multiplied by a power of 8 Eight unique symbols (digits) 0, 1, 2, …, 7

11 Binary number system Binary Positional, base-2 system
Each digit is multiplied by a power of 2 Two unique symbols (digits), 0 and 1

12 Binary number system Digital and binary relationship
The language of computers use binary digits Only 2 possible values 0 and 1 Much simpler to make electronics that distinguish between one of two values Distinguishing between more than two values is very difficult

13 Binary number system Since binary digits have two possible values
Binary digits are called bits They only contain a little “bit” of information Numbers represented in binary form will (most likely) require more digits (bits) than the decimal form

14 Binary Number System How do 2 bits represent 4 values? Bit Pattern
Numeric Value Item Represented 00 Black 01 1 White 10 2 Red 11 3 Green

15 Binary Number System How do 3 bits represent 8 values? Bit Pattern
Numeric Value Item Represented 000 Black 001 1 White 010 2 Red 011 3 Green 100 4 Blue 101 5 Purple 110 6 Magenta 111 7 Sky blue

16 Binary Number System How do 4 bits represent 16 values? Bit Pattern
0000 1000 8 0001 1 1001 9 0010 2 1010 10 0011 3 1011 11 0100 4 1100 12 0101 5 1101 13 0110 6 1110 14 0111 7 1111 15

17 Binary Number System Bit patterns and numeric values are consistent with other slides Acceptable to add leading 0’s if desired

18 Binary number system To represent more information
Lump together multiple bits called strings One bit: 2 values Two bits: 4 values (00, 01, 10, 11) Three bits: 8 values (000, 001, …, 111) Four bits: 16 values (0000, …, 1111) Five bits: 32 values Six bits: 64 values Seven bits: 128 values Eight bits: values

19 Binary number system number of values = 2number of bits In general
1 = 20 2 = 21 4 = 22 8 = 23 16 = 24 32 = 25 64 = 26 128 = 27 256 = 28

20 Binary number system Common grouping
4 bits: nibble 8 bits: byte One byte represents 256 different values or items

21 Binary Number System We can represent the non-negative numbers (unsigned number) How about representing negative numbers? Let the left most bit represent the sign (+, -) of the number Called signed magnitude representation [s][mag] 0 – 2number of bits - 1

22 Signed Magnitude One less bit to represent the magnitude

23 Signed Magnitude Problems Two values of 0 Incorrect arithmetic
More difficult to detect than one value of 0 Incorrect arithmetic 2 – 1 = 2 + (-1) = 1

24 Two’s Complement Representation
Sign bit in a sense Positive numbers The leading bit (left most) is zero The same as signed magnitude Negative numbers The leading bit is one Defined so that when added to their corresponding positive number the answer is zero

25 Two’s Complement Representation
Bit Pattern Value 0000 1000 -8 0001 1 1001 -7 0010 2 1010 -6 0011 3 1011 -5 0100 4 1100 -4 0101 5 1101 -3 0110 6 1110 -2 0111 7 1111 -1

26 Two’s Complement Representation
Problems with signed magnitude representation are solved with the two’s complement representation There is only value of zero Arithmetic is correct Solution is in two’s complement form 2 – 1 = 2 + (-1) = 1

27 Binary number system Letters in the English language
Z = 9010 = a = 9710 = Z = = Numbers are still left over for punctuation

28 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

29 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

30 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 left end Substitute the hex symbol 9010 = = 5A16 Is the base 16 really needed? 6610 = = 4216

31 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

32 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

33 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

34 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

35 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


Download ppt "COMS 161 Introduction to Computing"

Similar presentations


Ads by Google