Converting Int to Float or Float to Int using Bitwise operations (software floating point)

后端 未结 3 594
一生所求
一生所求 2020-12-01 13:04

I was wondering if you could help explain the process on converting an integer to float, or a float to an integer. For my class, we are to do this using only bitwise operato

3条回答
  •  臣服心动
    2020-12-01 13:38

    Have you checked the IEEE 754 floating-point representation?

    In 32-bit normalized form, it has (mantissa's) sign bit, 8-bit exponent (excess-127, I think) and 23-bit mantissa in "decimal" except that the "0." is dropped (always in that form) and the radix is 2, not 10. That is: the MSB value is 1/2, the next bit 1/4 and so on.

提交回复
热议问题