Вы находитесь на странице: 1из 43

NUMBER SYSTEMS

Number Systems
Binary
0, 1
Octal
0, 1, 2, 3, 4, 5, 6, 7
Decimal
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Hexadecimal
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
,8
,Ooops! There is no 8 in octal
10, 11, 12, 13, 14, 15 A, B, C, D, E, F
Data Representation in Computer
Systems
Bit
Binary digit
Either ON or OFF (high or low; 0 or 1)
Byte
8 bits
IBM System/360 mainframe computer established the use of 8 bits
as the basic unit of addressable computer storage
Word
With two or more adjacent bytes
16 bits, 32 bits, 64 bits
Nibbles (nybbles)
the 4-bit halves of an eight-bit byte
Low-order nibble; high-order nibble
Positional Numbering Systems
In the decimal numbering system, what does
243 mean?
Positional Numbering Systems
General Idea:
A numeric value is represented through increasing
power of a radix (or base)
Examples:
1) 243.51
10

= 2*10
2

= 200 + 40 + 30 + 0.5 + 0.01

= 243.51
Note: We are not doing a conversion here!

+ 4*10
1
+ 3*10
0
+ 5*10
-1
+ 1*10
-2

Boardwork 1
Evaluate the following decimal numbers:
1.) 43
10

2.) 527
10

3.) 9051
10

4.) 15401
10
5.) 128136
10


Conversion from any Base to Base 10
Using Positional Numbering Systems
Examples (From any base to base 10):

2) 212
3
to base 10
= 2*3
2
+ 1*3
1
+ 2*3
0

= 18 + 3 + 2
= 23
10


3)10110
2
to base 10
= 1*2
4
+ 0*2
3
+ 1*2
2
+ 1*2
1
+ 0*2
0

= 16 + 0 + 4 + 2 + 0
= 22
10




In general, the relationship between a digit, its
position, and the base of the number system
is expressed by the following formula:
Number Systems
Positional Numbering Systems
Board Work 2
Convert the following to Base 10 (Decimal)

2. 13
8

4. 2173
8

3. 100011110
2

5. 67F
16

1. 4B
16

ANSWERS
Conversion Base 10 (dec) to Any base
Division Remainder Method
The remainders end up being the digits of the
result and are read from bottom to top
From Base 10

to Base 2
Most significant bit 1 2 )
( 0 2 2 )
42
10

101010
2

Answer:
( 1 5 2 )
( 0 2 )
(Least significant bit
42 2 )
Quotient
21
0
Remainder
2 )
10
( 1
( 1
0 When quotient becomes 0,
division stops. Read bottom-up
From Base 10

to Base 16
5,735
10

1667
16
Answer:
0 16 )
( 1 Most significant bit 1 16 )
( 6 22 16 )
( 6 358 16 )
( 7 Least significant bit 5,735 16 )
Quotient
Remainder
Boardwork 3
Convert the following decimal numbers using
division method:
1. 104 to Base 3
2. 147 to Base 2
3. 803 to Base 16
4. 539

to Base 16



5. 1246

to base 16

6. 48

to base 2

7. 537

to base 8

8. 1576

to base 16

ANSWERS
Converting Fractions
Multiplication Method
Multiply fractional part by radix
Set apart integer part
Continue multiplying fraction part by radix until it
becomes 0
Read integer part top to bottom
Example: Convert 0.4304
10
to base 5
.4304 * 5 = 2.1520 2
.1520 * 5 = 0.7600 0
.7600 * 5 = 3.8000 3
.8000 * 5 = 4.0000 4 fractional part 0.
Done multiplying.

Answer: 0.2034
5


Boardwork 4
At least 3 bits to the right
Convert 0.375
10
to binary
Convert 0.825
10
to binary
ANSWERS
Conversion using Nibble Method
Convert 110010011101
2
to Octal and Decimal
= 110
= 6
= 6235
8


= 1100
= C
= C9D
16

010 011 101
2 3 5
1001 1101
9
D
Boardwork 5
Convert the given base to base 2
1. EF
16
2. 67
8
3. 92
16
4. 137
8
5. 1B1
16


Answers to Boardwork 2
1. 75
10
2. 11
10
3. 286
10
4. 1147
10
5. 1663
10
Answers to Boardwork 3
10212
3
10010011
2
323
16
21B
16
4DE
16
110000
2
1031
8
628
16


Answers to Boardwork 4
0.011
2
0.110
2

Checkup Quiz. Complete the table below.
Show your solution(s).
Decimal Binary Octal Hexadecimal
54.8125
10



1101111.011
2




11.4
8





1FD.A2
16

NUMBER SYSTEMS (contd)
Binary Addition
KEEP IN MIND the following rules:

0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10
Examples
Take note where and when it is necessary to
carry the 1.
Boardwork
Do the following binary additions:
1 0 1 0 1 1 1 0 1 1
1 1 1 0 0 1 1 1 0 0 0 1
Binary Subtration
Take note of the following terms:
Minuend Subtrahend = Difference

KEEP IN MIND the following rules:
0 - 0 = 0
1 - 1 = 0
1 - 0 = 1
0 - 1 = 1 (we use the borrow system)



Examples
Subtract the binary numbers 10101
2
and
1110
2

1
1
1
1

0
1
1 0
1
1
1 0 0

2
Final Answer: 111
2

seatwork (1/2 crosswise)
Add the binary equivalent of the following
decimal numbers:
1) 21 and 115
2) 48 and 7
3) 4401 and 26
4) 7, 6, 13, 5, and 14
Obtain the Difference of the binary equivalent
of the following decimal numbers:
5) 2 from 10
6) 11 from 23
7) 45 from 136

Negative Values in Binary Number
System
Signed Magnitude (S.M.)
Ones Complement (O.C.)
Twos Complement (T.C.)
When working with the above, we restrict the
numbers in an n-bit system.
Signed Magnitude
Use the most significant bit as the sign bit, 0
for positive, 1 for negative.
Examples
001100 12
101100 -12
000101 5
100101 -5
Complement Systems
Complements are used in digital computers
for simplifying the subtraction operation (and
for logical manipulations).
Two types of complements:
(r-1)s complement or 1s complement
rs complement or 2s complement
Diminished Radix Complement (r-1)
1S complement is obtained by subtracting
each digit by from 1
Or put simply, 1s complement of a binary
number is formed by changing 1s to 0s and
vice versa


Diminished Radix Complement (r-1)
Examples: (changing 1s to 0s and vice versa)
1) 1011000 =
2) 0101101 =

Solution (long method, subtract from each digit from 1)
1) 1111111 1011000 = 0100111
2) 1111111 0101101 = 1010010
0100111
1010010
Radix Complement (r)
2s complement in binary is obtained by
getting the 1s complement of the number
then add 1
Or the 2scomplement can be also be
performed by leaving all least significant zeros
and the first nonzero digit unchanged, and
then replacing 1sby 0sand 0sby 1s in all
other higher significant digits.


Radix Complement (r)
Examples (first method):
obtain 1s then
complement add 1
1) 101100 010011 + 1 = 010100
2) 1101100 0010011 + 1 = 0010100
3) 0110111 1001000 + 1 = 1001001

Radix Complement (r)
Example (2
nd
method):
The 2scomplement of 101100 is 010100.
The 2scomplement of 0.0110 is 0.1010.
Subtraction with Complements
Example: Subtract 1000011 from 1010100
using 2s complement. (7-bit system)
1010100
2s complement + 0111101

1 0010001
Overflow bit in twos complement are ignored.
1010100
2
84
10

1000011
2
67
10

84
10
67
10
= 17
Subtraction with Complements
Example: Subtract 1000011 from 1010100
using 1s complement
1010100
1s complement + 0111100

10010000
Final answer is 0010001
2

+1
End-around carry
0010001
Seatwork: Convert / Compute
Compute using the indicated number
representations (signed number, 1s
complement, and 2s complement), and assume
8-bit number.
7 + (-5) signed magnitude
-13 + (10) twos complement
-9 + (-1) ones complement
12 + (-12) twos complement
Binary Multiplication
Multiply 111 by 10
1111
X 10
000
+ 111
1110
Remember:
1. Copy the multiplicand when the
multiplier is 1.
2. Write a row of zeros when the
multiplier is 0.
3. Shift your results one column to
the left as you move to a new
multiplier digit.
4. Add the results together using
binary addition to find the
product.
Binary Division
Answers to seatwork 1
1) 1000010000
2

2) 110111
2

3) 1000101001011
2

4) 101101
2

5) 1000
2

6) 1100
2

7) 1011011
2

Вам также может понравиться