how to convert 3 byte to float

Mario M. Mueller news.mueller at arcor.de
Sat Dec 8 06:47:49 EST 2007


John Machin wrote:

> On Dec 8, 9:34 pm, "Mario M. Mueller" <news.muel... at arcor.de> wrote:
>> Hi,
>>
>> I have a binary file containing 3 byte float values (big endian). How can
>> I read them into python? The struct module does not work, since it
>> expects 4 byte floats.
>>
>> Any hints?
>>
>> Mario
> 
> What does a three-byte float look like? To write an unpack routine
> from scratch, one would need to know position & size of the mantissa
> and exponent, position of sign bit, how infinities, NaN, -0 etc are
> represented (if at all) ...

Unfortunatly I don't know anything in detail about these floats (yet). Any
documentation about it seems to be lost... :( Maybe I can can get some
working C code in the next days.

Mario



More information about the Python-list mailing list