0

I have seen examples/references/previous questions, but I cannot seem to get my head around some of the cases.

To be more specific, when the numbers is 0x1.MMMMMpEEE, then I can parse out the mantissa representation, which is MMMMM and the exponent, which is EEE and convert them to binary representation. Putting them all together will give me what I want.

However, in cases like 0x8.60a91c16b9b28p-4 or 0x7.ffffffffffffcp-4, because of the 8 and 7 after the 0x, how do I parse this hexadecimal mantissa into bit-wise binary representation?

Quang Thinh Ha
  • 239
  • 2
  • 10
  • 3
    Divide digit string by power of two such that resultant significand part is in [1,2). Adjust exponent accordingly. So for the first example divide by 8 and adjust exponent by 3; for second example divide by four and adjust exponent by 2. – njuffa May 27 '22 at 19:49
  • @njuffa when you say "divide digit string by power of two", can you elaborate a bit more on this? Is this a bit shifting operator? – Quang Thinh Ha May 28 '22 at 22:04
  • 1
    For positive operands, x / 2**n = x >> n. Example `0x8.60a91c16b9b28p-4` turns into `0x1.0c152382d7365p-1`, which can already be handled successfully per the question. – njuffa May 28 '22 at 22:22

0 Answers0