how to convert 3 byte to float

John Machin sjmachin at lexicon.net
Sat Dec 8 05:54:10 EST 2007


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) ...




More information about the Python-list mailing list