chapter six numbering systems

40
Chapter Six NUMBERING SYSTEMS

Upload: kemp

Post on 23-Feb-2016

49 views

Category:

Documents


0 download

DESCRIPTION

Chapter Six NUMBERING SYSTEMS. Numbering systems. Way to count Types of numbering systems Non Systematic Old Egyptian numbers. Roman numbers Systematic (positional) Arabic numbers Indian numbers. Positional numbering systems properties. Symbols Phonetic Symbolic Base (radix) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter Six NUMBERING SYSTEMS

Chapter SixNUMBERING SYSTEMS

Page 2: Chapter Six NUMBERING SYSTEMS

Numbering systems

• Way to count• Types of numbering systems– Non Systematic • Old Egyptian numbers.• Roman numbers

– Systematic (positional)• Arabic numbers• Indian numbers

Page 3: Chapter Six NUMBERING SYSTEMS

Positional numbering systems properties

• Symbols– Phonetic– Symbolic

• Base (radix)– Number of the symbols is equal to the base

• Digits– Relation between digits is that the one in the higher digit divided

by the just lower digit is equal to the base.• The value is determined by the face value multiplied by the

base to the power of the position of that digit.

Page 4: Chapter Six NUMBERING SYSTEMS

Examples

• Octal– Symbols• 0, 1, 2, 3, …. ,7• One, two , zero , …., seven

– Base • 8

– Digits• (11)8 --- 1 in the higher digit / 1 in the lower digit =

(8)10

Page 5: Chapter Six NUMBERING SYSTEMS

How to pronounce a number in any system?• Start from left to right• Pronounce each digit at a time• At the end , pronounce in System so.• Example (121)8

– One two one in octal• Example (A98B)16

– A nine eight B in hexadecimal• Example (1101.1)2

– One one zero one point one in binary

Page 6: Chapter Six NUMBERING SYSTEMS

Examples of numbering systems

• There are many types, but we are going to study only some of them – Binary system ( Base 2)– Octal system ( Base 8)– Decimal (denary) (base 10)– Hexadecimal (base 16)

Page 7: Chapter Six NUMBERING SYSTEMS

Conversion between Systems

• We are familiar with decimal system.

• It is a good way to convert from/to decimal system

• Two ways to convert– From any system to

decimal– From decimal to any

system

Page 8: Chapter Six NUMBERING SYSTEMS

Conversion to Decimal • (dn…..d2 d1 d0 . d-1 d-2 ……) R = ( )10

Page 9: Chapter Six NUMBERING SYSTEMS

Examples

Page 10: Chapter Six NUMBERING SYSTEMS

Example

Page 11: Chapter Six NUMBERING SYSTEMS

Another method to convert to decimal

• Place the face value with space doubling between digits

• Place under each digit the weight of it which is the power of the base of that number.

• Multiply the number by its weight into a third row.

• Sum all the numbers in the third row

Page 12: Chapter Six NUMBERING SYSTEMS

Examples

Page 13: Chapter Six NUMBERING SYSTEMS

Conversion from Decimal System to any other system (Integer part only).

• You do integer division with the whole part by the required base until you reach the zero value as the quotient.

• The following shape shows the processing of doing this.

• Integer division process is illustrated in the following shape.

Page 14: Chapter Six NUMBERING SYSTEMS
Page 15: Chapter Six NUMBERING SYSTEMS

Examples

Page 16: Chapter Six NUMBERING SYSTEMS

Example

Page 17: Chapter Six NUMBERING SYSTEMS

Converting from one system to another system using number of digits

• This method is for certain types of system which has a relation between.

• Suppose you have two numbering systems: R1 and R2. there is a conversion method those two systems if R1n1 = R2n2, where n1 and n2 are both integer values greater than 0 and one of them is 1.

• What is meant by that? It means that every digit from R1 is equivalent to n2 of digits from R2

• Examples: 23 = 81 and 24 = 161 , which means every 3 digits of the binary system is equivalent to one digits in octal and so on.

Page 18: Chapter Six NUMBERING SYSTEMS

Method for converting using the number of digits.

• Make a table for the two systems that have the relation discussed in previous charts.

• You didn’t need to do that every time if you memorize that table.

• Group n2 of digits of the second system and replace it with one digit of first system starting from the right of the number.

• Or for every digit of first system, replace it with n2 digits of the second system

Page 19: Chapter Six NUMBERING SYSTEMS

Example

Page 20: Chapter Six NUMBERING SYSTEMS

Example

Page 21: Chapter Six NUMBERING SYSTEMS

Example

Page 22: Chapter Six NUMBERING SYSTEMS

Mathematical operations on binary system

• Addition• Subtraction– Normal way– Two’s complement

Page 23: Chapter Six NUMBERING SYSTEMS

Addition of binary numbers

• Align the binary numbers based on the fraction point.

• Add leading zero to the fraction part for the number that has less digits and tailing zeros to the whole number for the number that has less digits.

• Use the table of the addition which is described below to do the addition.

Page 24: Chapter Six NUMBERING SYSTEMS

Example of binary addition

Page 25: Chapter Six NUMBERING SYSTEMS

Addition example (cont)

Page 26: Chapter Six NUMBERING SYSTEMS

Addition technique if you have more than two binary numbers.

• Align all the number beneath each other based on the fraction point.

• Strike through each two ones of one digit and replace them with one on the just higher digit.

• Each column (digit) which has a single one the result will be one, and if doesn’t has any remaining ones then the result is zero.

• Repeat for all the digit until the last digit

Page 27: Chapter Six NUMBERING SYSTEMS

Example

Page 28: Chapter Six NUMBERING SYSTEMS

Subtraction with binary system

• Subtraction using the borrow technique.• Subtraction using the two’s complement– Two’s complement. (one’s complement +1)– One’s complement

Page 29: Chapter Six NUMBERING SYSTEMS

Subtraction with borrow.• Align the binary numbers

based on the fraction point. • Add leading zero to the

fraction part for the number that has less digits and tailing zeros to the whole number for the number that has less digits.

• Use the table of the subtraction which is described below to do the subtraction.

Page 30: Chapter Six NUMBERING SYSTEMS

How to perform subtraction with borrow

• Align the two binary numbers starting from the fraction point.• Do the following for each column of the numbers (four cases).

– If the two values of a single column are either zeroes or ones , then the result is zero with no borrow.

– Else if the higher value is one then the result is one with no borrow.– Else, which means that (the top minuend is 0 and the subtrahand is

one), we need to borrow. The borrow means we take one from the just higher bit leaving the one to be zero (cross it) . This borrowed one is interchanged to the lower bit into two ones. For this whole column cross out two ones and the remaining one is the result.

Page 31: Chapter Six NUMBERING SYSTEMS

Four Cases

Page 32: Chapter Six NUMBERING SYSTEMS

Example of Subtraction with Borrow

Page 33: Chapter Six NUMBERING SYSTEMS

One’s Complement

• Way to represent negative values.• Change every one in binary to zero and every

zero to 1

Page 34: Chapter Six NUMBERING SYSTEMS

Example

• Convert (1010011)2 one’s complement.– (0101100) 1’s

• Convert (1000010011) which is one’s complement to its binary value.– (0111101100)2

Page 35: Chapter Six NUMBERING SYSTEMS

Two’s complement

• It is a way to represent a number with both value and sign.

• The most important property is that the Most Significant Bit has a negative weight.

• To convert from two’s complement to decimal is an easy way. The only difference is that during computation the weight of the last bit is negative.

Page 36: Chapter Six NUMBERING SYSTEMS

Example to convert from two’s complement to decimal.

Page 37: Chapter Six NUMBERING SYSTEMS

Converting from decimal number to two’s complement

• We have two cases.– If it is a positive decimal number. It is the same as

normal binary except that you add 0 as MSB to the binary number.

– If it is negative decimal number.• Treat the number as if it is positive.• Convert it to binary number.• Put Zeroes to the left of the number.• Convert the zero to one and one to zero for all digits• Add one to the whole number.

Page 38: Chapter Six NUMBERING SYSTEMS

Subtraction using two’s complement

• Subtraction process requires two operands: minuend and subtrahend, normally the subtrahend is greater than the minuend.– Make sure you have more digits that accommodate

the value of the numbers by adding zeros to the left of the two numbers.

– Convert the subtrahend to two’s complement.– Add the two numbers.– If the number of digits of the result exceeds numbers

of digits both numbers. Cancel that digit.

Page 39: Chapter Six NUMBERING SYSTEMS

Example of Two’s complement subtraction.• Subtract 1001 from 101.

– Number of digits ( we need 5 digits for those numbers) so , we add trailing zeros • Minuend becomes 00101 and the subtrahend becomes 01001

– Convert the subtrahend to two’s complement• So it 01001 becomes 10111

– Add both numbers: 00101 to 10111 • 00101 +10111 = 11100

– As the number of digits of the result is that same as the number of the digits of both number. This is the result.

– (Note that as the last bit of the result is 1, it means the number is negative , to find its value. Follow the rules to convert from two’s complement to decimal)

Page 40: Chapter Six NUMBERING SYSTEMS

Example of Two’s complement subtraction.• Subtract 110 from 1011.

– Number of digits ( we need 5 digits for those numbers) so , we add trailing zeros • Minuend becomes 01011 and the subtrahend becomes 00110

– Convert the subtrahend to two’s complement• So it 00110 becomes 11010

– Add both numbers: 01011 to 11010• 01011+ 11010 = 100101

– Because we have six digits, the left most digits is discarded and keep the number of the digits to 5. the result will b 00101

– (Note that as the last bit of the result is 0, it means the number is positive, to find its value. Follow the rules to convert from two’s complement to decimal)