Base Numbering Systems PowerPoint PPT Presentation

presentation player overlay
1 / 38
About This Presentation
Transcript and Presenter's Notes

Title: Base Numbering Systems


1
Base Numbering Systems
  • Stewart Blakeway
  • FML 208
  • blakews_at_hope.ac.uk

2
Session Aims
  • To explain what a base numbering system is
  • How to work out representations of numbers
  • How to convert from Base 10 to Base 2 and back
    again
  • Performing arithmetic with Base 2
  • Representing Negative Numbers

3
Base 10 - Decimal
  • 4,367
  • Four Thousands
  • Three Hundreds
  • Six Tens
  • Seven Units
  • Each position of a digit represents a different
    weight

4
Position of Digits
  • 9735 (9 103) (7 102) (3 101) (5
    100).

Calculator
5
Question
  • Why is it called the Base 10 numbering system?

Because there are 10 digits. 1 2 3 5 5 6 7 8 9 0
6
Question
  • What is 11 11
  • 23
  • 6
  • 12
  • 110

The answer depends on the base numbering system
being used. In a base 10 system the answer would
be 22. In a base 2 system the answer would be
110.
7
Computers use Binary
  • Data is represented using the binary system.
  • Data is stored on main memory using electrical
    pulses, a strong electrical pulse through a
    wire/circuit will mean a "1" state and a weaker
    or no electrical pulse would mean a "0" state.

8
Base 2 - Binary
  • How many digits does a base 2 numbering system
    use?

TWO.
  • What are they?

1 and 0
9
Binary
  • Computers use the base 2 number system
  • The digits are known as BINARY DIGITS
  • This is where the term BIT comes from
  • BINARY DIGITS

10
More BITs
  • Obviously a BIT is useless by itself. A
    collection of bits can represent data.
  • If 2 bits were put together, we would have the
    following possible 4 states
  • 1st state 0 02nd state 0 13rd state 1
    04th state 1 1

11
Collections of BITs
  • Question A collection of 8 BITS is known as
    what?
  • It takes 8 BITS to store a single character!
  • How many different combinations can you have with
    an 8 Bit number?

A Byte
256, or 28
12
Position of the Numbers
  • In Base 10 (Decimal) we know that 12 is one 10
    and 2 units.
  • We know this because of the position of the
    digits.
  • The same applies in Base 2 (Binary).
  • Base 2 uses the same weighting system but with
    different weights!

13
Question
  • Why does Binary not use the same weights as
    Decimal?

Answer There are only 2 digits in Binary.
Therefore the weighing of the adjacent digit is a
multiple of 2.
Still confused?
14
Weighting
  • Remember we all read numbers from right to left

One Unit
Question How many units does 1 multiple signify
in Decimal?
A multiple of Units
15
Weighting Base 10
We know the Number to read Thirty Two Thousand
One Hundred and Forty Two because of the position
of the numbers
16
Weighting
  • Remember we read numbers from right to left

One Unit
Question How many units does 1 multiple signify
in Binary?
A multiple of Units
17
Weighting Base 2
We know the Number to read 1 instance of 16 0
instance of 8 1 instance of 4 0 instance of 2 1
instance of 1
Remember Base 2 Only has 2 digits. 1 or 0 On
or Off True of False
18
Converting
  • You will be expected to convert Binary to
    Decimal!
  • And perform arithmetic on Binary numbers

19
Base 2 - Position of Digits
  • 1101 is equivalent to
  • 1101 (1 23) (1 22) (0 21) (1 20)

Calculator
20
Weighting Base 2
We know the Number to read 1 instance of 8 1
instance of 4 0 instance of 2 1 instance of 1
8 4 1 13 is the Decimal. Easy!
21
Binary Arithmetic
  • Binary Arithmetic is easy once you understand the
    rules. Much easier than decimal.
  • The key fact to remember is that it is a base 2
    numbering system.
  • Remember that you have to carry across every 2
    and you cant go wrong. Well, theoretically!

22
Question
  • What is 1010
  • 1111
  • ___________
  • 11001
  • Remember start from the right!
  • 0 1 1
  • 1 1 2 (no such number, so it must be a
    multiple)
  • 1 1 2 (no such number, so it must be a
    multiple)
  • 1 1 1 3 (2 is the multiple so it leaves 1)
  • 0 1 1

23
Does it work with 3 numbers?
  • What is 0110011
  • 1100111
  • 1011001
  • ___________

24
Does it work with 4 numbers?
  • What is 0110011
  • 1100111
  • 1110110
  • 1011001
  • ___________

25
Subtraction?
  • What is 1111
  • 1010 -
  • ___________

Remember start from the right! 1 - 0 1 1 - 1
0 1 - 0 1 1 - 1 0 Answer 0101
26
What if we have to borrow?
  • The last example was deliberately easy!
  • What if we have to borrow from the previous
    column?
  • Lets take a look at base 10 to remind ourselves

27
Base 10 Subtraction
  • What is 364
  • 291 -
  • ___________

Remember start from the right! 4 - 1 3 6 - 9
Cant do! We have to borrow. It is base 10 so
we borrow 10. 16 - 9 7 2 - 2 0 (Its 2
because we borrowed 1) Answer 073
28
Base 2 Subtraction with borrow
  • Same rules apply across all numbering systems.
  • We however borrow 2 when dealing with base 2.

29
Subtraction?
  • What is 1101
  • 0111 -
  • ___________

Remember start from the right! 1 - 1 0 0 - 1
Cant do! We have to borrow. Its base 2 so
borrow 2. 2 - 1 1 0 - 1 Cant do! We have to
borrow. Its base 2 so borrow 2. 2 - 1 1 0 - 0
0 Answer 0110
30
Computers do not subtract!
  • The last example is how we subtract as humans and
    probably how we were all taught in school.
  • Computers do not subtract, they add!

31
How it works
  • This is achieved by using a mathematical rule
    that always works
  • First the number that is to be subtracted is
    turned into its negative representation
  • The numbers are then added together
  • In base 2 it is called twos compliment
  • It works in all base numbering systems

32
Base 10
  • 1000 -
  • 345
  • --------
  • 655
  • 1000
  • -345
  • -------
  • 655

33
Negative Numbers in Binary!
  • If in binary 101 represents the decimal 5. What
    is this as a negative?
  • Decimal is easy. We just stick a at the
    beginning to signify that it is minus 5.
  • Binary is easy too, however we do not have the
    luxury of a minus sign!

34
Converting Positive Binary to Negative
  • Converting positive to negative is relatively
    straight forward. For the purpose of this
    lecture we are assuming that we are using 4 bit
    addresses.
  • 0110 becomes 1001 (we just flip each digit)
  • Then we add 1. 1001 becomes 1010

35
Question
  • If 0110 is the decimal for 6. 1010 must be the
    negative representation.
  • Isnt 1010 the decimal number 10? How does the
    computer know it is a negative number?

36
Subtraction by Addition
  • Write the sum as normal.
  • Flip the smaller number.
  • Perform an addition.
  • Disregard the leftmost number.
  • Add 1.

37
Subtraction?
  • What is 1101
  • 0111 -
  • ___________

38
Any Questions?
  • You will be given exercises in your seminar.
  • You will be tested on this.
  • Hint One of the questions may ask you how
    computers know if its a negative or positive
    number!
Write a Comment
User Comments (0)
About PowerShow.com