Notices
Results 1 to 15 of 15

Thread: hexadecimal addition and subtraction

  1. #1 hexadecimal addition and subtraction 
    Forum Freshman
    Join Date
    Jan 2009
    Location
    London
    Posts
    19
    hi there,

    i was wondering if someone could explain me how to do the addition and subtraction without transofrming the hex into decimal, is there any method that will not make me do all these calculations with the 16?

    DEF15
    +ED77


    DEF15
    -ED77
    ?


    Reply With Quote  
     

  2.  
     

  3. #2 Re: hexadecimal addition and subtraction 
    Suspended
    Join Date
    Apr 2008
    Posts
    2,178
    Quote Originally Posted by asalvani
    hi there,

    i was wondering if someone could explain me how to do the addition and subtraction without transofrming the hex into decimal, is there any method that will not make me do all these calculations with the 16?

    DEF15
    +ED77


    DEF15
    -ED77
    ?
    I do not know of anyway. Other then a table or from memory, and converting them to decimal.

    Or a computer program that does it for you. A spread sheet could, excel would. A data base would.




    Sincerely,


    William McCormick


    Reply With Quote  
     

  4. #3  
    Forum Masters Degree Numsgil's Avatar
    Join Date
    Jan 2009
    Posts
    708
    Sure. But first let me ask how you learned to add. Do you do the 5 + 6 is 11. So that's 1, carry the 10 to the tens place?

    If so, you just have to change your thinking slightly. 5 + 6 is A, with no carry. 8 + 8 is 10, which is 0, carry the 1 to the 16's place.

    Hope that makes sense
    Reply With Quote  
     

  5. #4  
    Suspended
    Join Date
    Apr 2008
    Posts
    2,178
    Quote Originally Posted by Numsgil
    Sure. But first let me ask how you learned to add. Do you do the 5 + 6 is 11. So that's 1, carry the 10 to the tens place?

    If so, you just have to change your thinking slightly. 5 + 6 is A, with no carry. 8 + 8 is 10, which is 0, carry the 1 to the 16's place.

    Hope that makes sense


    Hex is messed up.

    0=0
    1=1
    2=2
    3=3
    4=4
    5=5
    6=6
    7=7
    8=8
    9=9
    A=10
    B=11
    C=12
    D=13
    E=14
    F=15


    100=256
    101=257
    1F1=497

    1000=4096
    3000=12288
    F000=61440

    I have to decode the Hex into decimal. You can multiply the first left hand digit of Hex by sixteen, for two place Hex, and add second digit to that sum.

    Multiply the left most digit by 256 for three place Hex, multiply the second digit by sixteen, add both of those sums together with the last digit.

    Four digit Hex you multiply the first left most number by 4096.

    But I bet if you worked with them day in and day out, you could just add them up in your head after a while, in Hex.

    Sincerely,


    William McCormick
    Reply With Quote  
     

  6. #5  
    Forum Freshman
    Join Date
    Jan 2009
    Location
    London
    Posts
    19
    sorry this a bit messy for me,
    i understand the technique and kinda like it i tried with some and got some right answers,
    but i tried with e27b
    +4eb
    and i can't understand what is going when adding b and b?
    is 22, how come i write 6?
    can u apply this technique to all this problem ?

    thanks

    apprieciated,

    Antonio
    Reply With Quote  
     

  7. #6  
    Forum Professor leohopkins's Avatar
    Join Date
    Dec 2006
    Location
    Dulwich, London, England
    Posts
    1,417
    Quote Originally Posted by William McCormick
    Quote Originally Posted by Numsgil
    Sure. But first let me ask how you learned to add. Do you do the 5 + 6 is 11. So that's 1, carry the 10 to the tens place?

    If so, you just have to change your thinking slightly. 5 + 6 is A, with no carry. 8 + 8 is 10, which is 0, carry the 1 to the 16's place.

    Hope that makes sense


    Hex is messed up.

    0=0
    1=1
    2=2
    3=3
    4=4
    5=5
    6=6
    7=7
    8=8
    9=9
    A=10
    B=11
    C=12
    D=13
    E=14
    F=15
    10=16
    11=17


    100=256
    101=257
    1F1=497

    1000=4096
    3000=12288
    F000=61440

    I have to decode the Hex into decimal. You can multiply the first left hand digit of Hex by sixteen, for two place Hex, and add second digit to that sum.

    Multiply the left most digit by 256 for three place Hex, multiply the second digit by sixteen, add both of those sums together with the last digit.

    Four digit Hex you multiply the first left most number by 4096.

    But I bet if you worked with them day in and day out, you could just add them up in your head after a while, in Hex.

    Sincerely,


    William McCormick
    10 and 11 ????????????????????????
    The hand of time rested on the half-hour mark, and all along that old front line of the English there came a whistling and a crying. The men of the first wave climbed up the parapets, in tumult, darkness, and the presence of death, and having done with all pleasant things, advanced across No Man's Land to begin the Battle of the Somme. - Poet John Masefield.

    www.leohopkins.com
    Reply With Quote  
     

  8. #7  
    Suspended
    Join Date
    Apr 2008
    Posts
    2,178
    Quote Originally Posted by leohopkins
    Quote Originally Posted by William McCormick
    Quote Originally Posted by Numsgil
    Sure. But first let me ask how you learned to add. Do you do the 5 + 6 is 11. So that's 1, carry the 10 to the tens place?

    If so, you just have to change your thinking slightly. 5 + 6 is A, with no carry. 8 + 8 is 10, which is 0, carry the 1 to the 16's place.

    Hope that makes sense


    Hex is messed up.

    0=0
    1=1
    2=2
    3=3
    4=4
    5=5
    6=6
    7=7
    8=8
    9=9
    A=10
    B=11
    C=12
    D=13
    E=14
    F=15
    10=16
    11=17


    100=256
    101=257
    1F1=497

    1000=4096
    3000=12288
    F000=61440

    I have to decode the Hex into decimal. You can multiply the first left hand digit of Hex by sixteen, for two place Hex, and add second digit to that sum.

    Multiply the left most digit by 256 for three place Hex, multiply the second digit by sixteen, add both of those sums together with the last digit.

    Four digit Hex you multiply the first left most number by 4096.

    But I bet if you worked with them day in and day out, you could just add them up in your head after a while, in Hex.

    Sincerely,


    William McCormick
    10 and 11 ????????????????????????
    Thanks for catching that I must have over looked a copy and paste accident.

    Sincerely,


    William McCormick
    Reply With Quote  
     

  9. #8  
    Suspended
    Join Date
    Apr 2008
    Posts
    2,178
    Quote Originally Posted by asalvani
    sorry this a bit messy for me,
    i understand the technique and kinda like it i tried with some and got some right answers,
    but i tried with e27b
    +4eb
    and i can't understand what is going when adding b and b?
    is 22, how come i write 6?
    can u apply this technique to all this problem ?

    thanks

    apprieciated,

    Antonio
    Every sixteen of any column to the right makes one more in the next column to the left. So 22 minus 16 leaves 6 carry the one.

    If I had to do this everyday, I would start to think in terms of 16. But for me I use a program to convert them. I just cannot safely accurately add in that base.

    Sincerely,


    William McCormick
    Reply With Quote  
     

  10. #9  
    Forum Masters Degree Numsgil's Avatar
    Join Date
    Jan 2009
    Posts
    708
    Quote Originally Posted by asalvani
    sorry this a bit messy for me,
    i understand the technique and kinda like it i tried with some and got some right answers,
    but i tried with e27b
    +4eb
    and i can't understand what is going when adding b and b?
    is 22, how come i write 6?
    can u apply this technique to all this problem ?

    thanks

    apprieciated,

    Antonio
    Well if you were a school child you'd just memorize that B + B = 18. But if you're like me you have to convert to decimal then unconvert. 0xB + 0xB = 12 + 12 = 24 = 16 + 8 = 0x10 + 0x08 = 0x18.
    Reply With Quote  
     

  11. #10  
    Suspended
    Join Date
    Apr 2008
    Posts
    2,178
    Quote Originally Posted by Numsgil
    Quote Originally Posted by asalvani
    sorry this a bit messy for me,
    i understand the technique and kinda like it i tried with some and got some right answers,
    but i tried with e27b
    +4eb
    and i can't understand what is going when adding b and b?
    is 22, how come i write 6?
    can u apply this technique to all this problem ?

    thanks

    apprieciated,

    Antonio
    Well if you were a school child you'd just memorize that B + B = 18. But if you're like me you have to convert to decimal then unconvert. 0xB + 0xB = 12 + 12 = 24 = 16 + 8 = 0x10 + 0x08 = 0x18.
    We used to practice adding in different bases. And to be honest it was ok to learn how to do it. But in all honesty there was a bit of confusing nonsense being injected into my head, trying to remember it all.

    It is easier to just create a little program to convert them. If you even have to do that anymore today. Who knows the memory scheme of Windows XT?


    Sincerely,


    William McCormick
    Reply With Quote  
     

  12. #11  
    Suspended
    Join Date
    Jan 2008
    Posts
    440
    Why not do what every engineer does, and just buy a calculator with a hex function, nobody does it in their head except for very easy sums when there is no calculator handy :wink: If you try to learn to do maths to the base 16 you will be wasting your time.
    Reply With Quote  
     

  13. #12  
    Suspended
    Join Date
    Apr 2008
    Posts
    2,178
    Quote Originally Posted by Megabrain
    Why not do what every engineer does, and just buy a calculator with a hex function, nobody does it in their head except for very easy sums when there is no calculator handy :wink: If you try to learn to do maths to the base 16 you will be wasting your time.
    If I had to work with those kinds of codes. I would create a data base, and create a history of my mathematical manipulation.

    Then I could just run down a list and check to see if I incorrectly input any of them. You lose the ability to check them, because there is not the familiarity of adding in the Arabic system we normally use. They are basically meaningless entries to me. So I would want a trail to quickly run down and check. The data base can keep track of other stuff that can coordinate to something in the program you are working on.

    Sincerely,


    William McCormick
    Reply With Quote  
     

  14. #13  
    Forum Masters Degree Numsgil's Avatar
    Join Date
    Jan 2009
    Posts
    708
    I always frown when someone says "use a calculator". And I'm not some old timer waving a slide rule around. We had calculators in school and my Ti-83 is basically an extension of myself. But if you have the inclination to learn stuff like this you'll almost always be faster than some guy on a calculator. It's totally worth it to be able to sit down and figure out the answer to something using just pen and paper. If nothing else it means you'll be able to rebuild society after the Mad Max style collapse :P
    Reply With Quote  
     

  15. #14  
    Suspended
    Join Date
    Jan 2008
    Posts
    440
    Quote Originally Posted by Numsgil
    I always frown when someone says "use a calculator". And I'm not some old timer waving a slide rule around. We had calculators in school and my Ti-83 is basically an extension of myself. But if you have the inclination to learn stuff like this you'll almost always be faster than some guy on a calculator. It's totally worth it to be able to sit down and figure out the answer to something using just pen and paper. If nothing else it means you'll be able to rebuild society after the Mad Max style collapse :P
    I see a calculator as a tool, an effective tool, I can actually perform maths on hex, even boolean you know, D and A = 8 etc but I see no need to deliberately learn to use it in place of a calculator, if you use it enough it will become second nature, as will binary. Of course understand it but use a tool, it will save you time in the long run.

    I am an old timer and still have several slide rules (none of mine have hex on them.. ) As for a mad max 're-boot' I'll become a potato farmer. (that's pronounced 'potatoe' not tomatoe... oh forgrt it...
    Reply With Quote  
     

  16. #15 One way to solve with easy converting 
    Forum Freshman
    Join Date
    Feb 2009
    Location
    Yangon
    Posts
    9
    In our university, we are using the simplest way. As described from other but I think you can easily try it. Use the decode list as below.

    0=0
    1=1
    2=2
    3=3
    4=4
    5=5
    6=6
    7=7
    8=8
    9=9
    A=10
    B=11
    C=12
    D=13
    E=14
    F=15

    But we will consider in column by column.
    I will give you an example of your question.
    DEF15+ED77
    State the form as follow
    DEF15
    ED77
    ---------

    consider first from the leftmost column, like decimal addition.
    7+5=12=C

    7+1=8

    F=15,D=13,F+D=15+13=28/16= carry = 1,remainder = 12= C.

    E+E=14+14=28+carry1=27/16= carry=1,remainder=13=D.

    D+carry1=E.

    So the answer is EDC8C.

    As similar way in subtraction is more easier.

    DEF15
    ED77
    --------

    5-7,impossible.
    So, we will get 16 from the right partner. So, it become like this.

    DEF0(21)
    ED7 7
    ----------
    21-7=14=E#

    As described in earlier, get 16 from right f.So,

    16-7=9#

    F will become E
    E-D=1#
    E-E=0#
    Write down D.#
    So your answer D019e
    You can solve your problem without using a computer or a calculator.
    Reply With Quote  
     

Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •