1. Gyanastra
  2. Digital Logic
  3. Signed Number Representation and Overflow
  4. Radix Complement (B's Complement) and Diminished Radix Complement (B-1's Complement)
Free lesson, no account needed 4 min read 12 practice questions after it
Asked in past papers9 times
  • GATE CSE20232022202120202019201720162000
  • ISRO2016

Digital Logic · Signed Number Representation and Overflow

Radix Complement (B's Complement) and Diminished Radix Complement (B-1's Complement)

Overview

In a base-BB number system, a number can be rewritten in complementary form so that subtraction is performed by addition with an adder.
There are exactly two such systems: the B-1's complement (diminished radix complement) and the B's complement (radix complement), and they differ by exactly 1.

Key concepts

  • Complementary number system: a way of writing a number in another form so that subtraction becomes easy using only addition (an adder).
  • B's complement (radix complement): the complement of xx is Bn−xB^n - x, where BB is the radix and nn is the number of digits in xx.
    It is called the radix complement because the radix is BB and the complement is taken with respect to BB.
  • B-1's complement (diminished radix complement): the complement of xx is Bn−1−xB^n - 1 - x. It is called the diminished radix complement because it uses B−1B-1, one less than the radix.
  • For a given base BB, either system may be chosen; in either one, subtraction is converted into addition with an adder.

How it works

  1. Identify the radix BB and count the number of digits nn in the number xx.
  2. For the B-1's complement (diminished radix complement), compute Bn−1−xB^n - 1 - x.
  3. For the B's complement (radix complement), compute Bn−xB^n - x.
  4. Alternatively, obtain the B's complement by adding 1 to the B-1's complement.

Formulas

  • B-1's complement (diminished radix complement) of xx: Bn−1−xB^n - 1 - x — BB = radix (base) of the number system, nn = number of digits in xx, xx = the given number.
  • B's complement (radix complement) of xx: Bn−xB^n - x — BB = radix, nn = number of digits in xx, xx = the given number.
  • Relationship: B’s complement=(B−1’s complement)+1B\text{'s complement} = (B-1\text{'s complement}) + 1.

Comparison

PropertyB-1's complementB's complement
Other nameDiminished radix complementRadix complement
FormulaBn−1−xB^n - 1 - xBn−xB^n - x
Relation—=(B−1’s complement)+1= (B-1\text{'s complement}) + 1
PurposeMakes subtraction easy using only an adderMakes subtraction easy using only an adder

Revision summary

  • For any base BB there are exactly two complementary systems: B-1's complement and B's complement.
  • B's complement = radix complement; B-1's complement = diminished radix complement.
  • In both formulas, nn is the number of digits of xx, not of the base.
  • Shortcut: B's complement = B-1's complement + 1 (just add 1 to the diminished radix complement).
  • The whole point of complements: replace subtraction with addition using an adder.

Previous-year exam insights

  • In 2's complement with n bits, the range is -2n−12^{n-1} to +2n−12^{n-1}-1; in 1's complement and sign-magnitude with n bits, the range is -(2n−12^{n-1}-1) to +(2n−12^{n-1}-1), and both have two representations of zero (+0 and -0).
    Asked inGATE 2019GATE 2022
  • Arithmetic overflow in n-bit 2's complement addition occurs only when two operands of the same sign produce a result of the opposite sign; adding operands of opposite signs can never overflow.
    Equivalently, overflow = carry into the sign bit XOR carry out of the sign bit.
    Asked inGATE 2022
  • To find the 2's complement representation of a negative number -x in n bits: write x in n-bit binary, take the 1's complement (flip all bits), then add 1; equivalently 2n−x2^{n} - x.
    The sign bit of a negative number is 1 and the MSB position has weight -2n−12^{n-1}.
    Asked inGATE 2019
  • In sign-magnitude representation, the magnitude field of an n-bit number holds n-1 bits, so the sum/difference of two n-bit sign-magnitude numbers may need n+1 bits to avoid overflow (one extra bit for the possible carry into the sign position).
    Asked inGATE 2019
  • IEEE-754 single precision: 1 sign bit, 8 biased exponent bits (bias 127), 23 fraction bits;
    value = (−1)Sx1.Fx2E−127(-1)^{S} x 1.F x 2^{E-127} for normalized numbers.
    E = 0 with F = 0 is zero, E = 0 with F ≠ 0 is denormal (value 0.Fx2−126)0.F x 2^{-126}), and E = 255 is infinity/NaN. The smallest normalized positive number has E = 00000001 and F = 0.
    Asked inGATE 2021GATE 2023
  • For floating-point multiplication/division: multiply/divide the significands and add/subtract the true exponents, then re-bias; the sign is the XOR of the operand signs.
    For addition/subtraction, align the exponents before operating.
    Asked inGATE 2020GATE 2022GATE 2023
Pages 1–2 of 2