1. We will be in Read Only mode (no new threads, replies, registration) for several hours as we migrate the forums to upgraded software.

# 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,154
39
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
19,129
6,148
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,154
39
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,936
1,229
Try a goolge search on binary arithmetic

Apr 5, 2008
19,915
4,142
Eric007 likes this.
6. ### Eric007 Thread Starter Senior Member

Aug 5, 2011
1,154
39
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
19,129
6,148
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,154
39
Is it ok now or you want me to add [SOLVED] ??

10. ### MrChips Moderator

Oct 2, 2009
19,129
6,148
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?