1
$\begingroup$

This week our lecturer in microprocessor architecture showed us how the two's complement and the ten's complement can be used to do subtract by doing addition.

For example: 15 - 7

maximalNumberOfTheCurrentRange - numberToSubtract + 1 => 99 - 7 + 1 = 93

Then

  15

+93

===

108 as intermediate result.

Now remove the leading 1. => It becomes the final result 8 !

But how does that work?

I mean: I understand how to do the algorithm. But I would to understand the trick which is used here.

Can someone explain it to me in an easy to understand way?

I would very appreciate it.

I'm not much into academic mathematics I should mention ...

Moreover: What's the difference between the so-called "one's complement" and the "two's complement"?

  • 0
    What you not understand in above method?2017-02-11
  • 0
    How shall I say? ... How does it work? Why does: Adding the number, which is necessary to reach the next digit in the number system, then adding, then removing the most highest digit have this effect?2017-02-11

1 Answers 1

1

1.) In above method -

If we have carry then we can ignore it.

So in 108. Carry digit is ignored and we have 08 as final answer.

See this for reference and example.

2.) I am trying to differentiate one's and two's complement using main advantage of 2's complement. Advantage of two's complement over one's complement is that two's complement only has one value for zero. One's complement has a "positive" zero and a "negative" zero.

Next, to add numbers using one's complement you have to first do binary addition, then add in an end-around carry value.

Two's complement has only one value for zero, and doesn't require carry values.

For reference see this.

  • 0
    Okay. I think I get it finally. By discarding the carry-value we get an effect as if we would subtract. The addition of 1 (+1) is for including the 0 which is actually a digit too.2017-02-11
  • 0
    Have just remembered some older type of clock and it helped me a lot. Please see: https://uhrforum.de/attachments/657891d1374414901-kundo-2000-prismenuhr-dscn2168.jpg2017-02-11
  • 0
    Mine pleasure bro :-)2017-02-11