- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

A signed-magnitude method is used by computers to implement floating-point operations. Signed-2’s complement method is used by most computers for arithmetic operations executed on integers. In this approach, the leftmost bit in the number is used for signifying the sign; 0 indicates a positive integer, and 1 indicates a negative integer. The remaining bits in the number supported the magnitude of the number.

Example: -2410 is defined as −

10011000

In this example, the leftmost bit 1 defines negative, and the magnitude is 24.

The magnitude for both positive and negative values is the same, but they change only with their signs.

The range of values for the sign and magnitude representation is from **-127** to **127**.

There are eight conditions to consider while adding or subtracting signed numbers. These conditions are based on the operations implemented and the sign of the numbers.

The table displays the algorithm for addition and subtraction. The first column in the table displays these conditions. The other columns of the table define the actual operations to be implemented with the magnitude of numbers. The last column of the table is needed to avoid a negative zero. This defines that when two same numbers are subtracted, the output must not be - 0. It should consistently be +0.

In the table, the magnitude of the two numbers is defined by P and Q.

**Addition and Subtraction of Signed Magnitude Numbers**

Operations | Addition of Magnitudes | Subtraction of Magnitudes | ||
---|---|---|---|---|

(+P) + (+Q) | +(P+Q) | P>Q | P<Q | P=Q |

(+P) + (-Q) | +(P-Q) | -(Q-P) | +(P-Q) | |

(-P) + (+Q) | -(P-Q) | +(Q-P) | +(P-Q) | |

(-P) + (-Q) | -(P+Q) | |||

(+P) - (+Q) | +(P-Q) | -(Q-P) | +(P-Q) | |

(+P) - (-Q) | +(P+Q) | |||

(-P) - (+Q) | -(P+Q) | |||

(-P) - (-Q) | -(P-Q) | +(Q-P) | +(P-Q) |

As display in the table, the addition algorithm states that −

When the signs of P and Q are equal, add the two magnitudes and connect the sign of P to the output.

When the signs of P and Q are different, compare the magnitudes and subtract the smaller number from the greater number.

The signs of the output have to be equal as P in case P > Q or the complement of the sign of P in case P < Q.

When the two magnitudes are equal, subtract Q from P and modify the sign of the output to positive.

The subtraction algorithm states that −

When the signs of P and Q are different, add the two magnitudes and connect the signs of P to the output.

When the signs of P and Q are the same, compare the magnitudes and subtract the smaller number from the greater number.

The signs of the output have to be equal as P in case P > Q or the complement of the sign of P in case P < Q.

When the two magnitudes are equal, subtract Q from P and modify the sign of the output to positive.

- Related Questions & Answers
- Explain the performance of cache in computer architecture?
- What is BCD Subtraction in Computer Architecture?
- Signals and Systems: Addition and Subtraction of Signals
- What is the performance measure of branch processing in computer architecture?
- What is the performance of Load-use delay in Computer Architecture?
- The magnitude of big data
- How does pipelining improve performance in computer architecture?
- Given an example of C pointer addition and subtraction
- How MySQL performs date arithmetic with addition and subtraction operators?
- Addition and Subtraction of Matrix using pthreads in C/C++
- Explain the methods of reducing the number of microinstructions in computer architecture?
- Explain the various DMA transfer modes in computer architecture?
- Discuss the Data Transfer Schemes in Computer Architecture?
- What are the types of Data Manipulation Instructions in Computer Architecture?
- What are the uses of multibyte data organization in computer architecture?

Advertisements