CleverSphere

Number systems formula sheet

Every rule and formula of the trainer on one page, for revision before the exam or to print.

Practise with problems

Number systems formula sheet · CleverSphere

To decimal

Topic page →
  • ·Value = Σ digit · base^position
  • ·Positions count from the right starting at 0
  • ·Hex: A = 10 to F = 15

From decimal

Topic page →
  • ·Divide by the base repeatedly
  • ·Read the remainders from bottom to top
  • ·Remainders 10 to 15 in hex: A to F

Hex and binary

Topic page →
  • ·Four bits = one hex digit
  • ·Split into groups of four from the right
  • ·Octal likewise with groups of three

Binary addition

Topic page →
  • ·0 + 0 = 0, 0 + 1 = 1
  • ·1 + 1 = 0, carry 1
  • ·1 + 1 + 1 = 1, carry 1

Two’s complement

Topic page →
  • ·Write the magnitude in binary
  • ·Invert every bit
  • ·Add 1
  • ·n bits: range −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1

Addition & overflow

Topic page →
  • ·Add bits normally; a carry past the width is dropped
  • ·Overflow: both addends have the same sign, the result the other
  • ·Different signs can never overflow

Fixed point

Topic page →
  • ·Integer part as usual
  • ·Double the fraction, note the digit before the point
  • ·Read from top to bottom
  • ·Not every decimal is finite in binary (0.1)
  • ·Write in binary and normalise: 1.… · 2^e
  • ·Exponent: e + 127
  • ·Mantissa: fraction bits without the leading 1, padded to 23 bits

Reading IEEE 754

Topic page →
  • ·Hex to binary, then split 1 + 8 + 23 bits
  • ·e − 127 gives the exponent
  • ·Value = (−1)^s · 1.m · 2^e

Special values

Topic page →
  • ·Exponent 0, mantissa 0: zero
  • ·Exponent 0, mantissa ≠ 0: denormalised
  • ·Exponent 255, mantissa 0: infinity
  • ·Exponent 255, mantissa ≠ 0: NaN

Gray code & BCD

Topic page →
  • ·Gray = x ⊕ (x >> 1)
  • ·Neighbours differ in one bit
  • ·BCD: four bits per decimal digit