# binary subtraction arithmetic!

Discussion in 'Embedded Systems and Microcontrollers' started by Eric007, Apr 14, 2012.

1. ### Eric007 Thread Starter Senior Member

Aug 5, 2011
1,054
33
Hello!

Can someone show me how to do this little calculation? I'm a bit confused!

00000 - 10011 = ?
00000 - 00010 = ?
00000 - 00011 = ?

Please show me how you do the borrowing and all that!

Last edited: Apr 15, 2012
2. ### MrChips Moderator

Oct 2, 2009
12,648
3,458
Computers do not do subtraction.
The simplest solution is to form the 2's complement and add.

3. ### Eric007 Thread Starter Senior Member

Aug 5, 2011
1,054
33
There must be a good reason why i'm asking this question...
Actually i'm multiplying signed number using 'Booth's Algorithm'

In fact, you perform a 2's complement only on the 'signed' number then you add.

--» 00000 - 00010 = 11110
--» 00000 - 00011 = 11101
--» 00000 - 10011 = 01101

Thanks MrChips!

4. ### t06afre AAC Fanatic!

May 11, 2009
5,939
1,222
Try a goolge search on binary arithmetic

Apr 5, 2008
15,806
2,389
Eric007 likes this.
6. ### Eric007 Thread Starter Senior Member

Aug 5, 2011
1,054
33
I did but the examples on google are too TRIVIAL and obvious but anyways I figured out how it works.

Thanks!

7. ### MrChips Moderator

Oct 2, 2009
12,648
3,458
Now, see if you can alter the thread title and icon to indicate that you're done with this thread.

Oct 22, 2011
543
41

9. ### Eric007 Thread Starter Senior Member

Aug 5, 2011
1,054
33
Is it ok now or you want me to add [SOLVED] ??

10. ### MrChips Moderator

Oct 2, 2009
12,648
3,458
We have to get the mods to allow the op to change the thread title, not the post title.

11. ### chrisw1990 Active Member

Oct 22, 2011
543
41
yeh but itll do for now?