Conversion from HEX to DEC
Results 1 to 5 of 5

Thread: Conversion from HEX to DEC

  1. #1
    Member
    Join Date
    Oct 2001
    Posts
    64

    Conversion from HEX to DEC

    Just for those of you that don't know or that just need a little refresher like me

    The simplest way to go from hex to dec is to go to binary first behold the table below!

    HEX DEC BINARY
    0 0 0000
    1 1 0001
    2 2 0010
    3 3 0011
    4 4 0100
    5 5 0101
    6 6 0110
    7 7 0111
    8 8 1000
    9 9 1001
    A 10 1010
    B 11 1011
    C 12 1100
    D 13 1101
    E 14 1110
    F 15 1111



    OH NO I stopped at 15 now what eh?

    Ill show ya

    Lets take the HEX number 1C8........

    Ok, now well take that number and transfer it into binary

    1 C 8

    0001 1100 1000

    Ok now the binary in Dec

    0 0 0 1 1 1 0 0 1 0 0 0
    ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
    2048 1024 512 256 128 64 32 16 8 4 2 1

    So if we add all those little ones and zero's up we get (drum roll please)

    456 and if I put that into my little windows calc and convert it into hex I get 1C8

    TA DA!

    Thanks for reading I hope this can make things a little clearer for hex or worked as a nice refresher,

    -=Legacy Boy=-
    I am such a 733T H@XOR with my new puuter that I got for christmas!

  2. #2
    AO Antique pwaring's Avatar
    Join Date
    Aug 2001
    Posts
    1,409
    There's an even easier way:
    1C8 -> (1 x 16^2) + (12 x 16^1) + (8 x 16^0) = 456

    Far simpler and less prone to errors.
    Paul Waring - Web site design and development.

  3. #3
    Member
    Join Date
    Oct 2001
    Posts
    64
    Yea If you have a calculator at your exam, I had to work this crap out by hand it was just easyer for me to do it this way but thanks for the input,

    LB

  4. #4
    AO Antique pwaring's Avatar
    Join Date
    Aug 2001
    Posts
    1,409
    It's hardly difficult to do 16^2 - use long multiplication if you have to. I doubt that you'd have to convert more than 4 hex figures to decimal (e.g. FF6CA).
    Paul Waring - Web site design and development.

  5. #5
    Member
    Join Date
    Oct 2001
    Posts
    64
    Acually I had to put mac address together and just random big numbers,
    I did not have fun

    LB,
    -=Legacy Boy=-

    -= You mean there is stuff better then DOS? =-

Posting Permissions

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

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides