IEEE 754 float representation of a number

Dennis Lee Bieber wlfraed at ix.netcom.com
Mon Dec 9 15:11:29 EST 2002


tommys fed this fish to the penguins on Monday 09 December 2002 06:38 
am:

> hmmm. Expected the line
> struct.pack('>f',3.04) to return these four bytes:
> 
> '\x40\x42\x8f\x5c' (IEEE 754 format)
> 
> but instead
> 
> '@B\x8f\\' was returned.
>
        And what are the ASCII values for the characters @ B \

        You likely have the desired bit pattern, just that some bytes in the 
pattern have printable representations, and hence were displayed with 
them rather than a \x escape.

-- 
 > ============================================================== <
 >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
 >      wulfraed at dm.net     |       Bestiaria Support Staff       <
 > ============================================================== <
 >        Bestiaria Home Page: http://www.beastie.dm.net/         <
 >            Home Page: http://www.dm.net/~wulfraed/             <




More information about the Python-list mailing list