Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Hex to Decimal Conversion?

I am converting numbers from hex to decimal by hand, but just can't seem to understand how to go about it. I understand the basics, 0-9ABCDE, but for some reason this is still confusing me. What do I do with the zeros at the end of my hex number?

What decimal number do the following bit patterns represent if they are floating point numbers using IEEE 754 standard?

Hex: 0x0C000000

Hex: 0xC4630000

I just need to know how to do this by hand so a step by step would be amazing.

4 Answers

Relevance
  • 9 years ago
    Favorite Answer

    The Asker requested a method by hand to convert from Hex to Dec. So,

    (Step 1) Understand what each hexadecimal digit stands for. The digits 0 through 9 stand for their decimal counterparts, while A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.

    (Step 2) Count the digits in the hexadecimal number you wish to convert. For example, the hexadicimal number A980C has five digits. Make a list of the decimal equivalents of each the five digits. For example, A980C becomes {10, 9, 8, 0, 12}.

    (Step 3) Multiply each number in the list by successive powers of 16, starting with 160 = 1 for the rightmost element of the list. For example, 12 is the rightmost element of our list, so we obtain:

    10(16^4) = 10(65536) = 655360

    9(16^3) = 9(4096) = 36864

    8(16^2) = 8(256) = 2048

    0(16^1) = 0(16) = 0

    12(16^0) = 12(1) = 12

    (Step 4) Add the numbers you obtained in Step 3. This is the decimal equivalent of the hexadecimal number. For example, 655360 + 36864 + 2048 + 0 + 12 = 694284

    So, for your first example: 0xC4630000

    12(16^7) = 12(268435456) = 3221225472

    4(16^6) = 4(16777216) = 67108864

    6(16^5) = 6(1048576) = 6291456

    3(16^4) = 3(65536) = 196608

    0(16^3) = 0(4096) = 0

    0(16^2) = 0(256) = 0

    0(16^1) = 0(16) = 0

    0(16^0) = 0(1) = 0

    3221225472 + 67108864 + 6291456 + 196608 = 3294822400

    Can you do the other? =) Hope that helps.

  • Anonymous
    9 years ago

    Rob is correct if you want to convert from hex (base 16) to dec (base 10).

    The zeros at the end of the hex number are placeholders. Just like how you learned to count. 1 is equal to 01 because the zero represents the ten's column and the 1 represents the one's column. But 01 is not equal to 10 because in the former the 1 is in the one's column and in the latter it in the ten's column. So 0x0C000000 is equivalent to 0x00C000000 or 0x000C000000 etc but 0x0C would be much less in value. The trailing zeros are what increasess the value of the number.

    If you want to convert hex to single precision floating point the conversion is similar. I assume single precision because you have 32 bits (the leading zero of 0C000000 is padding to indicate eight hex bits; 8*4 = 32)

    For 0x0C000000 to single precision floating point:

    0 hex is 0 dec is 0000 binary

    C hex is 12 dec is 1100 binary

    so 0x0C000000 is 0000 1100 0000 0000 0000 0000 0000 0000 b

    which can be broken up into:

    0 (the sign bit)

    000 1100 0 (the exponent)

    000 0000 0000 0000 0000 0000 (the mantissa)

    sign = 0

    exponent = 24

    mantissa = 0

    The floating point number can be calculated by (-1 ^ sign) * 2 ^ (exponent - bias) * (1 + mantissa)

    where the bias for single precision is 127.

    So (-1 ^ 0) * 2 ^ (24 - 127) * (1 + 0) = (1) * 2 ^ (-103) * (1) = 9.8607613 E -32

    Your other number 0xC4630000 (converting each hex bit to binary):

    1100 0100 0110 0011 0000 0000 0000 0000

    sign = 1

    exponent = 100 0100 0

    mantissa = 110 0011 0000 0000 0000 0000

    sign = 1

    exponent = 136

    mantissa is a little more difficult. Each bit uses inverse incrementing powers of 2. Bit 23 has value 1/2 (i.e. 2^ -1), bit 22 has value 1/4 (i.e. 2^ -2) etc. So the mantissa is 2^-1 + 2^-2 + 2^-6 + 2^-7 = 0.7734375

    So the floating point number is (-1 ^ 1) * 2 ^ (136 - 127) * (1 + 0.7734375) = (-1) * 2 ^ (9) * (1.7734375) = -908.0

  • 9 years ago

    The windows calculator on your computer will convert nicely.

Still have questions? Get your answers by asking now.