📊 Signed-Magnitude Arithmetic

Master Addition and Subtraction with Interactive Learning

🎯 Introduction

In digital systems, signed-magnitude representation is one of the simplest ways to represent positive and negative numbers.

Binary Representation

S
M₇
M₆
M₅
M₄
M₃
M₂
M₁

0 → Positive Number

1 → Negative Number

📋 All Possible Cases

Operation Add Magnitudes Subtract Magnitudes
Same Signs A > B A < B A = B
(+A) + (+B) +(A + B) – – –
(+A) + (−B) – +(A − B) −(B − A) +0
(−A) + (+B) – −(A − B) +(B − A) +0
(−A) + (−B) −(A + B) – – –
(+A) − (+B) – +(A − B) −(B − A) +0
(+A) − (−B) +(A + B) – – –
(−A) − (+B) −(A + B) – – –
(−A) − (−B) – −(A − B) +(B − A) +0

🔄 Algorithm

General Steps

  1. Check the operation (Addition or Subtraction)
  2. Compare the signs of A and B
  3. If signs are same → Add magnitudes (for addition)
  4. If signs differ → Subtract smaller from larger
  5. Assign result sign based on magnitude comparison
  6. If result = 0 → Always make it +0

💡 Key Points

✅ MSB is the sign bit
✅ +0 and −0 are equivalent
✅ Signs determine operation
✅ Zero is always positive

🧮 Interactive Calculator

📚 Example Practice

(+7) + (+5)
Same signs → Add magnitudes: 7 + 5 = 12
Result: +12
(+9) + (−4)
Different signs → Subtract: 9 − 4 = 5, sign of larger (A)
Result: +5
(−9) + (+4)
Different signs → Subtract: 9 − 4 = 5, sign of larger (A)
Result: −5
(+6) − (+6)
Same signs → Subtract: 6 − 6 = 0
Result: +0

📊 Algorithm Flowchart

Start: Check Operation
Compare Signs of A and B
Same Signs? Add Magnitudes
Different? Subtract Magnitudes
Determine Result Sign
If Zero → Make it +0
Display Result
Start Learning Signed Magnitude Hardware