confusion in arithmetic addition

Discussion in 'Homework Help' started by annujain501, Jul 28, 2010.

  1. annujain501

    Thread Starter New Member

    Jul 28, 2010
    6
    0
    i am having hard time in addition of numbers in same base..!!! here are two of such questions

    1) (FE) + (78) = ? {all in base-16}

    using the logic as understand,solution i infer :

    FE
    78


    E+8=14+8=22---> 15+7---> F+7---> therefore,7 is carry

    7
    FE
    78
    F
    similarly 7 + F +7= F+E;


    7
    FE
    78
    EFF

    2) x567 +27x5 = 75yx (all in base-8)

    if i use the logic same as above,i get :

    x567
    27x5

    7+5= 12---> 5 is carry;x=7

    5
    x567
    27x5----> 2755
    75y7


    5+6+5=16--->7+8;y=7

    now 8+5+7=20----> this is obvly...wrong....

    where i m getting wrong..??
     
    Last edited: Jul 28, 2010
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    Do the math in binary -

    (FE) 1111 1110
    (78) 0111 1000
    (176)1 0111 0110

    Convert to decimal - FE is 254, 78 is 120, sum is 374. 374d is 176h
     
  3. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    907
    There are all sorts of workarounds, such as converting to decimal or binary, but I hope you now see your basic error: there is a place holder for when the sum equals the base.

    Look at, for example, 8d + 2d = 0d plus carry 10 (or one "10").

    Eh +2h = 0h plus carry 10h (one 16, that is).

    Similarly, in your example and using your symbols, E + 8 = 14 +8 = 22 ---->6 plus carry 10 (one 16, that is).

    John
     
  4. annujain501

    Thread Starter New Member

    Jul 28, 2010
    6
    0
    one thing that i understood is that i cannot take 7 as carry because it not of the same radix system.
    okay,but i didnt got the idea of 'one "10"' carry
    and therefore in my problem 6 plus 10h as carry :(

    could you explain it in elaboration..??:)
     
  5. annujain501

    Thread Starter New Member

    Jul 28, 2010
    6
    0

    yes,this could be the way out but when we go for MCQs this procedure may consume time unnecessarily.
    so we go for a method that is both accurate and less time consuming.:)
     
  6. Papabravo

    Expert

    Feb 24, 2006
    10,178
    1,799
    You need to make yourself a hexadecimal addition table. Then you do the problem in hex. For example:
    Code ( (Unknown Language)):
    1.  
    2.   0xFE
    3. + 0x78
    4.  
    5. E + 8 = 0x16 so you put down the 6 and carry the 1
    6. F + 7 + 1 = = 0x17 so you put down the 7 and carry the 1
    7. 1 + 0 = 1 so the answer is 0x176
    8.  
    If we are dealing with 8-bit registers then of course the answer becomes 0x76 and the carry gets lost. That is what happens in modulo arithmetic

    Second problem requires an octal addition table. I do this stuff in my head because I learned it 51 years ago when I was in the 7th grade.

    Code ( (Unknown Language)):
    1.  
    2.   x567
    3. + 27x5
    4. -------
    5.   75yx
    6.  
    7. 7 + 5 = 014 so x = 4 and we carry a 1
    8. 6 + 4 + 1 = 013 so y = 3 and we carry a 1
    9. 5 + 7 + 1 = 015 so we put down a 5 and carry a 1
    10. 4 + 2 + 1 = 007 so we put down the 7 and there is no carry
    11.  
    AND - Tah dah everything is right with the world.
     
  7. annujain501

    Thread Starter New Member

    Jul 28, 2010
    6
    0

    thank u so much sir,i think this is exactly what i need to understand...

    but sir how do calculate E+8=0x16 and why have we taken FE as 0xFE? if i could understand this everything will become clear.
     
  8. annujain501

    Thread Starter New Member

    Jul 28, 2010
    6
    0
    thank u so much sir,now i got it,n after using addition tables any problem could be solved easliy thanks a lot.. :)
     
  9. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
  10. Papabravo

    Expert

    Feb 24, 2006
    10,178
    1,799
    Using a prefix of "0x" to denote a hexadecimal number is a convention I first learned in from "The C Programming Language" by Kernighan & Ritchie. Similarly a leading 0 denotes a number in octal (base-8) notation. I use these conventions almost without thinking and assume that everybody knows and understands them. It was presumptuous and I apologize.
     
Loading...