Introduction: Introduction & Learning Goals
This lesson explains how computers use different number systems such as decimal, binary, octal, and hexadecimal. It also teaches how to convert numbers between systems and how to perform binary arithmetic operations.
Learning Outcomes
Number: Number Systems
Decimal Number System Base 10
Binary Number System Base 2
Octal Number System Base 8
Hexadecimal Number System Base 16
Conversion: Converting Between Number Systems
Number Conversion
Example:
101012 = (1 *2^4) + (0 * 2^3) + (1 * 2^2) + (0 * 2^1) + (1 * 2^0)
= (1x16) + (1* 8) + (1*4) + (0*2) + (1*1)
= 16 + 0 + 4 + 0 + 1
= 21β10
Example:
1258 = (1* 8^2) + (2 * 8^1) + (5 * 8^0)
= (1 * 64) + (2 * 8) + (5 * 1)
= 64 + 16 + 5
= 85β10
Hex Decimal
0-9 0-9
A 10
B 11
C 12
D 13
E 14
F 15
Example:
E = 14 ; 8 = 8 ;B = 11
E8Bβ16 = (14 * 16^2) + (8 * 16^1) + (1 * 16^0)
= (14 * 256) + (8 * 16) + (11 * 1)
= 3,584 + 128 + 11
=3723β10
Example:
17β10 = 10001β2
Example:
127β10 = 177β8
Example:
960β10 = 3C0β16
Base-to-Base Conversions:
Base
Binary β Octal Binary β Decimal β Octal
Octal β Binary Octal β Decimal β Binary
Hex β Binary Hex β Decimal β Binary
Hex β Octal Hex β Binary β Octal
Example:
1010101β2 = 125β8
A2Bβ16 = 101000101011β2
Arithmetic
Binary Addition Rules
Rules:
Example:
101 + 101 = 1010
1's Complement
To get 1's complement, change all 0s to 1s and all 1s to 0s.
Example:
10101110 β 01010001
Purpose:
Adding Signed Numbers
Include three cases:
Example:
1101 + (-1001) = 0101
Binary Subtraction
Rules:
Example:
1010 - 101 = 0101