using 2's complement to perform binary division for signed number

user2963216 picture user2963216 · Oct 28, 2015 · Viewed 12.8k times · Source

first of all this is not a duplicate question of this one because it's already not answered this part.

as i searched for many resources and i ended with no clear perception how to perform signed number divion using 2's complement specifically for the case where one of the divisor or dividend or both are negative .

i rode that part of signed number division from Digital Fundamentals By:Floyed in chapter 2 and all examples and problems even through internet resources explain division only on positive numbers as explained bellow:

enter image description here

enter image description here enter image description here

,but what if 100/-25 or -100/25 or -100/-25 what is the rules to follow.

so can any one give a simple explanation how for example to divide 14 by -7.

Answer

guy777 picture guy777 · Sep 16, 2020

The rules states that if the numbers have different sign bits that the quotient and remainder gotten when both are divided(this is after the have both been turned positive) will be negative.So for 14/-7, they will have different sign bits when turned to binary so this means your quotient and remainder will be negative. Now you leave 14 in positive form and turn -7 to it's corresponding positive binary number and carry out the division with the positive forms of both numbers, when you get your quotient and remainder from dividing the positive form of both numbers you turn both the quotient and remainder negative.