J
JJ
- Jan 1, 1970
- 0
Have been trying to do 32bit signed subtraction using two's compliment but I
can't seem to get correct figures if either (or both)of the original
operands are negative.
For a simple example in real math, 3 subtract -2 is 5, but the two's
compliment routines say the result is -1.
Am I missing something or is two's compliment unsuitable for mixed sign
subtraction?
The routines are public domain and work precisely for two positive operands
so it appears the routines are working correctly.
Do I need to go to another form of subtraction(fixed/floating point)?
What I really want is to find a quick way to find the difference between two
32bit signed numbers.
Anyone?
Thanks
JJ
can't seem to get correct figures if either (or both)of the original
operands are negative.
For a simple example in real math, 3 subtract -2 is 5, but the two's
compliment routines say the result is -1.
Am I missing something or is two's compliment unsuitable for mixed sign
subtraction?
The routines are public domain and work precisely for two positive operands
so it appears the routines are working correctly.
Do I need to go to another form of subtraction(fixed/floating point)?
What I really want is to find a quick way to find the difference between two
32bit signed numbers.
Anyone?
Thanks
JJ