add 2-digit bit BCD numbers

Discussion in 'Programmer's Corner' started by help_please, Feb 19, 2012.

  1. help_please

    Thread Starter New Member

    Feb 18, 2012
    6
    0
    I believe I have this working correctly but am not positive what happens once you hit 100, do you have another carry to add to the ones place?

    For example:

    Is 57 + 57 suppose to equal 115?
    99 + 99 = 199?
    99 + 1 = 101?
    99 + 2 = 102?

    Yet 17 + 59 = 76?

    Just want to make sure I'm doing this right!!
     
    Last edited: Feb 19, 2012
  2. MrChips

    Moderator

    Oct 2, 2009
    12,447
    3,363
    No.

    57 + 57 = 14

    99 + 99 = 98

    99 + 1 = 00

    99 + 2 = 01
     
  3. help_please

    Thread Starter New Member

    Feb 18, 2012
    6
    0
    Humm ok

    Well I'm displaying 3 digits so it would display hundreds digit.
    I was just a little confused as if the carry would carry again.

    So is it basically just straight up addition?
     
  4. MrChips

    Moderator

    Oct 2, 2009
    12,447
    3,363
    Sorry, you didn't say you were displaying three digits. In that case:

    57 + 57 = 114

    99 + 99 = 198

    99 + 1 = 100

    99 + 2 = 101
     
  5. help_please

    Thread Starter New Member

    Feb 18, 2012
    6
    0
    That was my fault, sorry! Ok thanks for the help!!
     
Loading...