---
title: "Division of signed integers"
subject: "Computer Organization and Architecture"
chapter: 5
key: "semester_5/computer_organization_and_architecture:signed-division"
source: https://www.bctengineer.com/q/semester_5/computer_organization_and_architecture/signed-division
site: BCT Engineering
---

# Division of signed integers

Computer Organization and Architecture · Chapter 5: Computer Arithmetic

- Asked in: 2069 Asar, 8 marks
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_organization_and_architecture/signed-division
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_organization_and_architecture/chapter-5

## Question

How can division of signed integers be performed? Explain with example.

## Short answer

Use sign-magnitude division: divide absolute values, then set quotient sign to XOR of operand signs and remainder sign to dividend sign. For -15 divided by 4, magnitude division gives quotient 3 and remainder 3, so the result is quotient -3, remainder -3.

## Answer

Division of signed integers is done on the magnitudes (sign-magnitude method), and the signs are handled separately:

1. Store the sign of the dividend (Sd) and of the divisor (Sv); take the absolute values.
2. Divide the magnitudes with the restoring or non-restoring algorithm to get quotient Q and remainder R.
3. **Quotient sign** = Sd XOR Sv (negative if the signs differ).
4. **Remainder sign** = sign of the dividend, so that dividend = divisor × quotient + remainder.
5. If the dividend and divisor are in 2's complement, convert negative values to positive before step 2 and convert the results back at the end.
6. Check for divide overflow: the divisor must not be 0 and the quotient must fit in the register.

#### Example: −15 ÷ 4 (4-bit magnitudes)

- Sd = 1, Sv = 0, so quotient sign = 1 XOR 0 = 1 (negative); remainder sign = 1 (negative).
- Divide the magnitudes 15 ÷ 4 with restoring division:

```text
Step  Action                  A      Q
-     Initial                 00000  1111
1     Shift left A,Q          00001  1110
      A = A - M (1 - 4 = -3)  11101  1110
      A<0: Q0=0, restore A    00001  1110
2     Shift left A,Q          00011  1100
      A = A - M (3 - 4 = -1)  11111  1100
      A<0: Q0=0, restore A    00011  1100
3     Shift left A,Q          00111  1000
      A = A - M (7 - 4 = 3)   00011  1000
      A>=0: Q0=1              00011  1001
4     Shift left A,Q          00111  0010
      A = A - M (7 - 4 = 3)   00011  0010
      A>=0: Q0=1              00011  0011
```

Magnitude result: quotient 3, remainder 3.

**Answer: −15 ÷ 4 = quotient −3, remainder −3**, because 4 × (−3) + (−3) = −15.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. How is signed integer division done?
   A. Divide the 2's complement forms directly with no changes
   B. Divide the magnitudes and handle signs separately
   C. Convert to floating point
   D. Always use only positive divisors
   Answer: B. Signs are stored, absolute values divided, and signs fixed at the end. (Key point: Method)

2. What is the sign of the quotient?
   A. Sd XOR Sv
   B. Sign of the dividend
   C. Sd AND Sv
   D. Sign of the divisor
   Answer: A. Quotient is negative if the signs differ, i.e. XOR. (Key point: Quotient sign)

3. What sign does the remainder take?
   A. The sign of the divisor
   B. Always positive
   C. The sign of the dividend
   D. Sd XOR Sv
   Answer: C. This keeps dividend = divisor x quotient + remainder. (Key point: Remainder sign)

4. What is the result for -15 / 4?
   A. Quotient -4, remainder 1
   B. Quotient 3, remainder -3
   C. Quotient -3, remainder 3
   D. Quotient -3, remainder -3
   Answer: D. 15 / 4 = 3 remainder 3; quotient sign negative, remainder sign follows dividend. Check: 4 x (-3) + (-3) = -15. (Key point: -15 / 4)

## Related in Computer Organization and Architecture

- [Signed division and non-restoring division](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Anonrestoring-division) — Computer Organization and Architecture, chapter 5
- [Division operation and hardware](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Adivision-hardware) — Computer Organization and Architecture, chapter 5
