0% found this document useful (0 votes)
12 views33 pages

CH 2 Binary Numbers 2015

The document discusses binary numbers and number systems including logic, electrical circuits, polarity, and binary numbers. It covers representing numbers in different bases such as binary, octal, and hexadecimal. Methods for converting between number bases and performing arithmetic in different bases are also explained.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views33 pages

CH 2 Binary Numbers 2015

The document discusses binary numbers and number systems including logic, electrical circuits, polarity, and binary numbers. It covers representing numbers in different bases such as binary, octal, and hexadecimal. Methods for converting between number bases and performing arithmetic in different bases are also explained.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Binary values and number systems

Chapter 2

1
 Logic:
A statement is either True or False
Often represented by a T or F.
 Electrical Circuits:
A lamp will be On or Off
A circuit can have current flow or no flow (switch on or
off)
 Polarity:
Positive or negative.

 Binary – composed of, relating to, or involving 2.

2
How many ones make up 642???
600 + 40 + 2 ?
i.e. 6 hundreds, 4 tens, and 2 ones
6x102 + 4x101 + 2x100
What would it mean if we counted in
eights?
6x82 + 4x81 + 2x80
Then it would mean 418 counting in tens.

3
642 in base 10 positional notation is:

6 x 102 = 6 x 100 = 600


+ 4 x 101 = 4 x 10 = 40
+ 2 x 10º = 2x1 =2 = 642 in base 10

The power indicates


This number is in the position of
base 10 the number
4 6
 6 hundreds and 4 tens and 2 ones is the
representation of this number in BASE 10.

 The base of a number determines the


number of digits and the value of digit
positions.

 What is special about 10?

5
R is the base
of the number
As a formula:

dn * Rn-1 + dn-1 * Rn-2 + ... + d2 * R + d1

n is the number of d is the digit in the


digits in the number ith position
in the number

642 is 63 * 102 + 42 * 10 + 21

7
6
 Can you show that this representation must
always be unique?

7
 Binary numbers are numbers where
the BASE IS 2
 This means there can only be two digits 0 and
1 (Why?)
 Counting in Binary:
0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001
and so on...
 Why does Base 2 interest us so much?

8
 Octal is where we use BASE 8
 The digits are then 0, 1, 2, 3, 4, 5, 6, 7

 Hexadecimal is where we use BASE 16


 The digits are then 0, 1, 2,3, 4, 5, 6, 7, 8, 9,
A, B, C, D, E, F

9
10
 What is 1010 (as a base 10 number) if the
base is 2, 8, 10 and 16?
 10
 520
 1010
 4112

11
1. Computers represent data in binary code:
off/on, false/true, 0/1;
2. Thus we would like to represent numbers in
such a format;
3. We can represent numbers in any base. We
are used to base 10 but this is habit; it is not
driven by mathematics;
E.g. 642 is 63 * 102 + 42 * 10 + 21
4. In base R the number dn dn-1 … d2 d1 means:
dn * Rn-1 + dn-1 * Rn-2 + ... + d2 * R + d1
5. Arithmetic works in any base exactly as in base 10.

12
R is the base
of the number
As a formula:

dn * Rn-1 + dn-1 * Rn-2 + ... + d2 * R + d1

n is the number of 64210 d is the digit in the


digits in the number ith position
is in the number

1202
642 = 164*8*3 10
+ 22 +*842 +*010 1 1+ +22
*8
3 3 2 2 11

110091807060504031201 7
13
Addition in Base 2:
We want to add the two numbers

1010111 and
1001011

14
Remember that there are only 2 digits in binary,
0 and 1

1 + 1 is 0 with a carry

Carry Values
1011111
1010111
+1 0 0 1 0 1 1
10100010

15 14
 Let’s take 111011 away from 1010111.

16
Remember borrowing? Apply that concept
here:

12
202
1010111
- 111011
0011100

17
Mark groups of three (from right)
This is because three binary digits exactly
represent the octal digits 0, 1, 2, 3, 4, 5, 6, 7
i.e. 000, 001, 010, 011, 100, 101, 110, 111
Example: Convert 10101011 to octal

010 101 011


2 5 3
10101011 in base 2 is 253 in base 8

18
Mark groups of four (from right)
This is because each group of four binary
digits represents one hexadecimal digit

Example: Convert 10101011(binary) to hex.


1010 1011
A B
10101011 is AB in base 16

19
Algorithm for converting number in base 10
to other bases:
While (the quotient is not zero)
◦ Divide the decimal number by the
new base
◦ Make the remainder the next digit
to the left in the answer
◦ Replace the original decimal
number with the quotient

20
 We write out the number in decimal, but
expand it in terms of the new base R:
N = dn * Rn-1 + dn-1 * Rn-2 + ... + d2 * R + d1
 Divide by the base and take the remainder:
N/R = dn * Rn-2 + dn-1 * Rn-3 + ... +d3R+ d2
Remainder is d1.
Repeating:
N/R2 = dn * Rn-3 + dn-1 * Rn-4 + ... +d4R+ d3
Remainder is d2.
AND SO ON…

21
What is 1988 (base 10) in base 8?

22
248 31 3 0
8 1988 8 248 8 31 8 3
16 24 24 0
38 08 7 3
32 8
68 0
64
4

Answer is : 3 7 0 4

23
What is 3567 (base 10) in base 16?

24
222 13 0
16 3567 16 222 16 13
32 16 0
36 62 13
32 48
47 14
32
15

So result is DEF

25
 We can extend the idea of working to
different bases to the fractional part of a
number.

 What does 645.456 mean in Base 10?

 Why not do this in other bases???

26
dn * 2n-1 + dn-1 * 2n-2 + ... + d2 * 21 + d1 * 20
(radix point) + d-1 * 2-1 + d-2 * 2-2 + d-3 * 2-3
+…
Thus (binary) 101.011means:
22 + 20 + 1/22 + 1/23
= 5 3 /8
What would hexadecimal A5.FF be in decimal?
165 255/
256

27
 Suppose the fraction is in Base 10 and we
want to convert to another base.

◦ Multiply the decimal part of the


number by the new base
◦ The integer part is the next digit to
the right in the answer
◦ Replace the original decimal
number with the fractional part
◦ Continue until…

28
dn * 2n-1 + dn-1 * 2n-2 + ... + d2 * 21 + d1 * 20
(radix point) + d-1 * 2-1 + d-2 * 2-2 + d-3 * 2-3
+…
 Keep only the radix part:
 (radix point) + d-1 * 2-1 + d-2 * 2-2 + d-3 * 2-3 + …

 Multiply by 2:
 d-1 (radix point) + d-2 * 2-1 + d-3 * 2-2 + …

29
 Convert 0.1to binary, hexadecimal, and octal

 .00011,

 .19

 .06314

30
 Subtraction of Binary fractions
 10110.000
 - 1010.011
 ANS 1011.101

31
Bit (Binary digit)

Byte 8 bits

The number of bytes in a word determines


the word length of the computer, but it is
usually a multiple of 8

32-bit machines
64-bit machines

32
 Understand the importance of Binary digits
to data representation in computers;
 Understand the positional representation of
numbers in different bases;
 Understand the relationship between base 2,
and base 8 and base 16 numbers;
 Convert from base R to base 10;
 Convert from base 10 to base R;
 Do arithmetic in different bases.
33

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy