Numbers Systems and Conversions

Intro

  1. Decimal Number System: 10 digits (0—9)
  2. Binary Number System: 2 digits (0—1)
  3. Octal
  4. Hexadecimal

Remember: Mathematically, number systems can represent any value, it is the hardware that has limits.

Number Systems

Decimal

More on Positional Notation:

Example: Converting “123” into a decimal number, digit-by-digit ((1 \times 10) + 2) \times 10 + 3

Example: Positional notation with decimal points 1234.567 = 1 \times 10^3 + 2 \times 10^2 + 3 \times 10^1 + 4 \times 10^0 + 5 \times 10^{-1} + 6 \times 10^{-2} + 7 \times 10^{-3}

Binary

More on Bytes:

Range: \text{Range: } 2^n - 1

Octal

Hexadecimal

Conversion

A. Decimal to Binary

Repeated Division by 2:

  1. Divide the decimal by two. The remainder will be a bit (0 or 1)
  2. Do step one again, until we we can no longer divide the decimal.
  3. The last remainder is the most significant bit, add up the bits in reverse order we derived them.

B. Binary to Decimal

Power Table:

BinaryDecimal
2^01
2^12
2^24
2^38
2^416
2^532
2^664
2^7128
2^8256

C. Binary to Octal

  1. Begin grouping triplets of bits from right-to-left
  2. Convert each triplet of bits into octal

Example:

BinaryOctal
0000
0011
0102
0113
1004
1015
1106
1117

D. Binary to Hexadecimal

  1. Begin groups 4 groups of bits from right-to-left.

Example:

Exercise

DecimalBinaryOctalHexadecimal
33
1110101
703
1AF