← Back to Home

ELEC3020 - Lecture 1
Number Representations - Slides

Fixed Point Numbers

For a number in base :

We can easily convert to base 10:

Signed Binary Numbers

Two’s Complement Representation

  • 2’s complement of a binary number is formed by taking 1’s complement of the number and adding 1 to the least significant bit
    • Alternate way: complement bits to the left of the rightmost 1
  • 1’s complement negates numbers by complementing each bit of the number

2’s complement = 1’s complement +1

Taking the 2’s complement of a binary number negates it (changes its sign)

  • Summing the complement of a number with itself should equal 0


Converting 2’s complement binary to decimal:

  • Same process as earlier, but minus away the sign bit

Link to original

Signed Numbers

Rule of thumb -> the signed negative number for any binary or hexadecimal number when added to itself, equals zero

Floating Point Numbers

  • IEEE standard for FP numbers

  • 32 bits, single precision:

    • 1 bit sign, 8 bits exponent, 23 bits fraction


Special Cases

Exponent = 0

  • Fraction = 0 -> result = 0
  • Fraction 0 -> result =

Exponent = 255

  • Fraction = 0 -> result is infinity
  • Fraction 0 -> result is NaN

ELEC3020 - Lecture 3