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,117
    36
    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!

    Thanks in advance!
     
    Last edited: Apr 15, 2012
  2. MrChips

    Moderator

    Oct 2, 2009
    14,496
    4,268
    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,117
    36
    There must be a good reason why i'm asking this question...
    Actually i'm multiplying signed number using 'Booth's Algorithm'

    But yeah your " 2's complement and add" method works.
    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,224
    Try a goolge search on binary arithmetic
     
  5. bertus

    Administrator

    Apr 5, 2008
    17,101
    3,001
    Eric007 likes this.
  6. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,117
    36
    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
    14,496
    4,268
    Now, see if you can alter the thread title and icon to indicate that you're done with this thread.
     
  8. chrisw1990

    Active Member

    Oct 22, 2011
    543
    41
    see this thread
     
  9. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,117
    36
    Is it ok now or you want me to add [SOLVED] ??
     
  10. MrChips

    Moderator

    Oct 2, 2009
    14,496
    4,268
    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?
     
Loading...