Reading a non-standard floating point format

Bengt Richter bokr at oz.net
Sat Apr 26 13:41:03 EDT 2003


On Fri, 25 Apr 2003 21:09:28 +0100, Fidtz <fidtz at clara.co.uk> wrote:
[...]
>Thanks for the info, I was worried that might be the situation!
>
>The closest thing I have to a definition from the AlphaBasic programming
>manual: The reason for this is that floating point numbers occupy six
>bytes of storage. Of the 48 bits in use for each 6-byte variable, the
>high order bit is the sign of the mantissa. The next 8 bits represent
>the signed exponent in excess-128 notation, giving a range of
>approximately 2.9*10^-39 through 1.7*10^38. The remaining 39 bits
>contain the mantissa, which is normalized with an implied high-order bit
>of one. This gives an effective 40-bit mantissa which results in an
>accuracy of 11 significant digits. 
>
>I had a go this afternoon and managed to read the sign and something
>approximating the exponent, though I will have to test the edge
>conditions carefully :) 
>
Got some test data? Is it big-endian or little-endian? Or do you need to handle both?

Regards,
Bengt Richter




More information about the Python-list mailing list