Digital Electronics Representation Of Signed Numbers

Representation of Signed and Unsigned Numbers
Unsigned Numbers

Unsigned numbers are non-negative integers. They can be represented using a variety of methods, including:

  • Binary: Unsigned numbers can be represented in binary using a sequence of 0s and 1s. The most significant bit (MSB) is the leftmost bit, and the least significant bit (LSB) is the rightmost bit. The value of an unsigned binary number is the sum of the values of its individual bits. For example, the unsigned binary number 101101 represents the decimal number 45.
  • Decimal: Unsigned numbers can also be represented in decimal using a sequence of digits from 0 to 9. The most significant digit (MSD) is the leftmost digit, and the least significant digit (LSD) is the rightmost digit. The value of an unsigned decimal number is the sum of the values of its individual digits. For example, the unsigned decimal number 45 represents the decimal number 45.
  • Hexadecimal: Unsigned numbers can also be represented in hexadecimal using a sequence of digits from 0 to 9 and the letters A to F. The most significant digit (MSD) is the leftmost digit, and the least significant digit (LSD) is the rightmost digit. The value of an unsigned hexadecimal number is the sum of the values of its individual digits. For example, the unsigned hexadecimal number 2D represents the decimal number 45.
Signed Numbers

Signed numbers are numbers that can be either positive or negative. They can be represented using a variety of methods, including:

  • Sign-magnitude: In sign-magnitude representation, the sign of a number is represented by a single bit. The MSB is the sign bit, and the remaining bits represent the magnitude of the number. If the sign bit is 0, the number is positive. If the sign bit is 1, the number is negative. For example, the sign-magnitude representation of the decimal number -45 is 101101.
  • Two’s complement: In two’s complement representation, the sign of a number is represented by the MSB. If the MSB is 0, the number is positive. If the MSB is 1, the number is negative. The magnitude of a negative number in two’s complement representation is the complement of its positive representation. For example, the two’s complement representation of the decimal number -45 is 1100101.
  • One’s complement: In one’s complement representation, the sign of a number is represented by the MSB. If the MSB is 0, the number is positive. If the MSB is 1, the number is negative. The magnitude of a negative number in one’s complement representation is the complement of its positive representation. For example, the one’s complement representation of the decimal number -45 is 101100.
Comparison of Signed and Unsigned Numbers

The following table compares signed and unsigned numbers:

Feature Signed Numbers Unsigned Numbers
Range Can be positive or negative Can only be positive
Representation Sign bit + magnitude No sign bit
Addition Can be added using addition or subtraction Can only be added using addition
Subtraction Can be subtracted using addition or subtraction Can only be subtracted using subtraction
Multiplication Can be multiplied using multiplication or division Can only be multiplied using multiplication
Division Can be divided using division or multiplication Can only be divided using division
Complementary Number Representation

Complementary number representation is a method of representing numbers using two’s complement notation. In this representation, the most significant bit (MSB) of a number is used to indicate the sign of the number. If the MSB is 0, the number is positive. If the MSB is 1, the number is negative.

The remaining bits of the number are used to represent the magnitude of the number. The magnitude of a positive number is simply the binary representation of the number. The magnitude of a negative number is the binary representation of the number with the MSB inverted.

For example, the number 5 is represented in complementary number representation as 00000101. The number -5 is represented as 11111011.

Advantages of Complementary Number Representation

Complementary number representation has several advantages over other number representations, such as sign-magnitude representation and one’s complement representation.

  • Simplicity: Complementary number representation is the simplest of the three number representations. It is easy to understand and implement.
  • Efficiency: Complementary number representation is the most efficient of the three number representations. It requires only one bit to represent the sign of a number.
  • Error detection: Complementary number representation can be used to detect errors in data transmission. If the MSB of a number is not equal to the complement of the other bits, then the number has been corrupted.
Disadvantages of Complementary Number Representation

Complementary number representation also has some disadvantages.

  • Overflow: Complementary number representation can suffer from overflow. This occurs when the magnitude of a number is too large to be represented in the available bits.
  • Underflow: Complementary number representation can also suffer from underflow. This occurs when the magnitude of a number is too small to be represented in the available bits.
Applications of Complementary Number Representation

Complementary number representation is used in a variety of applications, including:

  • Computers: Complementary number representation is the most common number representation used in computers.
  • Calculators: Complementary number representation is used in many calculators.
  • Digital signal processing: Complementary number representation is used in digital signal processing to represent signals that can be both positive and negative.

Complementary number representation is a simple, efficient, and error-detecting number representation. It is the most common number representation used in computers and other digital devices.

Signed Magnitude Form

The signed-magnitude form is a way of representing signed numbers in binary. It is similar to the way we represent signed numbers in decimal, where the first bit of the number indicates whether the number is positive or negative.

In the signed-magnitude form, the most significant bit (MSB) of the number is used to indicate the sign of the number. If the MSB is 0, the number is positive. If the MSB is 1, the number is negative.

The remaining bits of the number represent the magnitude of the number. The magnitude of a number is the absolute value of the number, without regard to its sign.

For example, the binary number 01101001 represents the positive number 101. The MSB is 0, so the number is positive. The remaining bits represent the magnitude of the number, which is 101.

The binary number 11101001 represents the negative number -101. The MSB is 1, so the number is negative. The remaining bits represent the magnitude of the number, which is 101.

Advantages of Signed Magnitude Form

The signed-magnitude form has several advantages over other ways of representing signed numbers in binary.

  • Simplicity: The signed-magnitude form is very simple to implement in hardware. This is because the only operation that is required is a comparison of the MSB to 0.
  • Compatibility: The signed-magnitude form is compatible with the way that we represent signed numbers in decimal. This makes it easy to convert between signed numbers in binary and decimal.
Disadvantages of Signed Magnitude Form

The signed-magnitude form also has several disadvantages.

  • Ambiguity: The signed-magnitude form can be ambiguous in some cases. For example, the binary number 10000000 can represent either the positive number 0 or the negative number -0.
  • Inefficiency: The signed-magnitude form is not as efficient as other ways of representing signed numbers in binary. This is because the MSB of a signed-magnitude number is always 0 or 1, which means that one bit of the number is always wasted.

The signed-magnitude form is a simple and compatible way of representing signed numbers in binary. However, it is also ambiguous and inefficient. For these reasons, the signed-magnitude form is not as widely used as other ways of representing signed numbers in binary.

1’s Complement Form

The 1’s complement of a binary number is found by inverting (flipping) each bit of the number. For example, the 1’s complement of 11001001 is 00110110.

Steps to find the 1’s complement of a binary number:
  1. Write down the binary number.
  2. Invert each bit of the number.
  3. The resulting number is the 1’s complement of the original number.
Example:

Find the 1’s complement of 11001001.

  1. Write down the binary number: 11001001
  2. Invert each bit of the number: 00110110
  3. The resulting number is the 1’s complement of the original number: 00110110
Uses of 1’s Complement:
  • The 1’s complement is used in some computer arithmetic operations, such as subtraction.
  • The 1’s complement is also used in some error-detection schemes.
Advantages of 1’s Complement:
  • The 1’s complement is easy to calculate.
  • The 1’s complement can be used to represent negative numbers.
Disadvantages of 1’s Complement:
  • The 1’s complement is not a self-complementing code. This means that the 1’s complement of the 1’s complement of a number is not the original number.
  • The 1’s complement can lead to overflow errors. This can occur when the result of an arithmetic operation is too large to be represented in the available number of bits.
2’s Complement Form

The 2’s complement form is a way of representing signed integers in binary. It is the most common format used in computers today.

How 2’s Complement Works

The 2’s complement form of a signed integer is found by taking the 1’s complement of the integer and then adding 1.

For example, the 1’s complement of the binary number 0110 is 1001. Adding 1 to this gives us 1010, which is the 2’s complement form of -6.

Advantages of 2’s Complement

The 2’s complement form has several advantages over other ways of representing signed integers.

  • Simplicity: The 2’s complement form is very simple to implement in hardware.
  • Efficiency: The 2’s complement form allows for efficient addition and subtraction of signed integers.
  • Range: The 2’s complement form can represent a wider range of integers than other formats.
Disadvantages of 2’s Complement

The 2’s complement form also has some disadvantages.

  • Overflow: The 2’s complement form can overflow if the result of an addition or subtraction is too large or too small to be represented in the given number of bits.
  • Sign Extension: When converting a signed integer from a smaller number of bits to a larger number of bits, the sign bit must be extended to the left. This can be a source of errors if not done correctly.

The 2’s complement form is a powerful and efficient way of representing signed integers. It is the most common format used in computers today.