I'm having trouble converting 19861119 into ieee floating point format (single precision). I hope someone can tell me where I've lost my way.
In binary, the value is b1:00101111:00001110:01111111 (using : to mark every 8 bits from the rhs), which is b1.00101111:00001110:01111111 * 2^24. So the float is b00101111:00001110:01111111 and the biased exponent is 24 + 127 = 151 = b10010111. The float is 24 bits long but ieee format only allows 23 bits for it, which looks problematic to me. Does the format lack sufficient precision to store a yyyymmdd date?
When I write the output from Python's struct.pack("f", 19861119) to file and take a look with a hex editor, I see x4087974b. After allowing for little-endianness this is x4b978740. So Python has written a biased exponent of b01010111 = 87 and a float of b0010111:10000111:01000000 which bear little resemblance to any of the numbers I calculated. What have I missed?
Thanks in advance,
Ian