Question

I am changing an 8-digit hexadecimal number to a real number Y. The number is 0xAC0396ED

My question is: Shall I take into consideration the 0x? What is the significance of the 0x? I researched it and based on wikipedia, I got this: "use the prefix 0x for numeric constants represented in hex"

What I plan on doing is take the part AC0396ED and change it to binary, then from binary manipulate the 32 bit number byte dividing the number intro 3 parts: sign, exponent, and fraction.

My last question is why do we need hexacdecimal, decimal, octal? Why don't we just stick to binary in all our arithmetic and operations?

Thank you.

Was it helpful?

Solution

My question is: Shall I take into consideration the 0x? What is the significance of the 0x?

No - you should not take that into consideration - its only a notation for hexadecimal base system

What I plan on doing is take the part AC0396ED and change it to binary, then from binary manipulate the 32 bit number byte dividing the number intro 3 parts: sign, exponent, and fraction.

Here is how you calculate it:

AC0396ED =>

10 12 0 3 9 6 14 13 in decimal. Then to binary

1010 1100 0000 0011 1001 0110 1110 1101

here you have all bits i.e 32 bits

  1 | 01011000 | 00000111001011011101101

so the first bit is 1 => the number is negative

the second is the exponent

the third is the mantissa

My last question is why do we need hexacdecimal, decimal, octal? Why don't we just stick to binary in all our arithmetic and operations?

Its much more easy to stick to hexadecimal system - compare the 32 bits to the AC0396ED

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top