Pages

Sunday, February 6, 2011

Numbers and Number Systems

Natural Numbers
  • {1, 2, 3, ....}
Whole Numbers
  • {0, 1, 2, 3, ...}
Integers
  • Either signed or unsigned, denoted by \mathbb{Z} referring to the set of all integers
Decimal (Base 10) Digits 0 - 9
  • Utilizes the digits 0 - 9
Rational Numbers
  • Terminating decimals, or repeating decimals (P / Q) Where P & Q are both integers, and Q != 0.
  • 1/1 = 1 is a rational number, 2/1 is a rational number.
Irrational Numbers
  • Neither terminate nor repeat, ie:  π (Pi)
Real numbers
  • Rational Numbers + Irrational Numbers
Binary
  • Base 2
  • Converting Whole numbers to binary is easy.
  • Steps are as follows:
  1. Divide by 2, remainder represents LSB (Least Significant Bit)
  2. Continue to divide by two, until division by 2 is not possible. 
  3. The final remainder will represent the MSB (Most Significant Bit)
  4. Written MSB on left, LSB on right.
Example: 25(base ten) : 25 / 2 = 12 r. 1[LSB], 12 / 2 = 6, r. 0, 6 / 2 = 3 r.0, 3/2 = 1 r.1, 1/2 = 0. r 1[MSB]
Written: 11001
  • Like all systems utilizes place value.  Ie:  10110 = (1 * 2^4) + (0 * 2^3) + (1 *2^2) + (1 * 2^1) + (0 * 2^0) = 22

Hexadecimal
  • Base 16
  • Utilizes digits 0 - 9
  • Expands, to include A, B, C, D, E, F - A representing 10, continuing respectively
  • Utilizes the same place value system as used in our number systems across the board, however with a base of 16.
  • Example: 2BD = (2 * 16^2) + (11 * 16^1) + (2 * 16^0)
  • Converting Whole numbers to hexadecimal is identical to converting whole numbers to binary except a divisor of 16 is used.   Example:  589 / 16 = 36 r. 13, 36 / 16 = 2 r. 4, 2 / 16 = 0 r. 2 , written: 24D
  • Converting hexadecimal to binary, divide the Hex Digits into 4 bit patterns (nibbles), 24D for example = 0010 / 0100 / 1101 -> 001001001101
  • Each hex digit = nibble, 2 Hex digits = 1 byte

No comments:

Post a Comment