Professional Documents
Culture Documents
Lecture1 - Number Systems
Lecture1 - Number Systems
Lecture1 - Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Outline
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Outline
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Number systems
1 2
numbers could be represented in any base in a base system, digits used range from 0 to (base - 1). For example, in base 3, digits 0, 1 and 2 are used. prex/subscript/sux used in indicating what base representation was used
Number Systems
Computer Arithmetic
Number systems
1 2
numbers could be represented in any base in a base system, digits used range from 0 to (base - 1). For example, in base 3, digits 0, 1 and 2 are used. prex/subscript/sux used in indicating what base representation was used which of the following is an invalid number?
Number Systems
Computer Arithmetic
1 2
base 2 natural for computers - on and o signals base 10 natural for human - why?
Number Systems
Computer Arithmetic
Decimal to Binary
Conversion from Decimal to Binary: 1 Divide the decimal number by 2, store the remainder 2 Continuously divide until quotient becomes less than 1 3 Read the remainders in reverse acquisition order
Number Systems
Computer Arithmetic
Question
Number Systems
Computer Arithmetic
Binary to Decimal
Conversion from Binary to Decimal:
1
Starting from the right, multiply the binary digit by powers of 2. Begin at 2 raised to 0(which is 1). Add sums
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
How to convert from Decimal to Hexadecimal? Vice-versa? same procedure as Decimal to Binary/Binary to Decimal - just replace the divisor by 16, and the powers of 2 by powers of 16!
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Outline
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Overow
What is overow? Overow indicates an insuciency of the number of our bits to represent the sum
Number Systems
Computer Arithmetic
Overow
What is overow? Overow indicates an insuciency of the number of our bits to represent the sum How is this detected?
Number Systems
Computer Arithmetic
Overow
What is overow? Overow indicates an insuciency of the number of our bits to represent the sum How is this detected?
If the CARRYOUT value of the LEFTMOST digits is 1, overow occured.
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
How could we do multiplication? Could we pull o multiplication using just ADDITION? Yes! Multiplication is just a repeated addition
Number Systems
Computer Arithmetic
How could we do multiplication? Could we pull o multiplication using just ADDITION? Yes! Multiplication is just a repeated addition Take note: Another possible hardware solution - ROM!
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
How could we do subtraction? What is subtraction in essence anyway? Its just an addition between oppositely signed numbers 1-1=0 1 + (-) 1 = 0
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Get the complement of each and every digit in the number. This is called its Ones Complement Representation
Number Systems
Computer Arithmetic
Get the complement of each and every digit in the number. This is called its Ones Complement Representation
Number Systems
Computer Arithmetic
Number Systems
Computer Arithmetic
Why dont we just use the 1C Notation? There are 2 representations for 0: 0000 and 1111 - confusing!
Number Systems
Computer Arithmetic
Characteristics of Twos Complement Notation Leftmost digit tells us whether the number is positive or negative - 0 for positive, 1 for negative
Number Systems
Computer Arithmetic
Characteristics of Twos Complement Notation What is the implication of this for the representable range?
Number Systems
Computer Arithmetic
Characteristics of Twos Complement Notation Binary numbers in 2C notation would usually have the subscript 2C to dierentiate from those in ordinary notation
Do we convert to decimal the same way as before?
Number Systems
Computer Arithmetic
Overow in 2C Addition
How do we detect overow in 2C addition? Leftmost CARRYOUT value no longer indicative. Instead, we check the signs of addends and sum.
If signs of operands are dierent, overow could NOT occur! (subtraction) If signs of operands are the same, sum MUST also have the same sign. If not, then overow occured.
Number Systems
Computer Arithmetic
Usage
Where do we use unsigned numbers? 2C? 2C notation is used where signed numbers are needed - data. Unsigned notation used in character-encoding schemes and addresses.
Number Systems
Computer Arithmetic
Usage
Where do we use unsigned numbers? 2C? 2C notation is used where signed numbers are needed - data. Unsigned notation used in character-encoding schemes and addresses.
ASCII Unicode
Number Systems
Computer Arithmetic
ASCII
Number Systems
Computer Arithmetic
Unicode
Number Systems
Computer Arithmetic
So...
Any questions?