IEEE 754 float representation of a number
tommys
bob_tommy at hotmail.com
Tue Dec 10 01:47:00 EST 2002
sismex01 at hebmex.com wrote in message news:<mailman.1039445771.31848.python-list at python.org>...
> > From: bob_tommy at hotmail.com [mailto:bob_tommy at hotmail.com]
> > Sent: Monday, December 09, 2002 8:39 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.
> >
> > What have I missed here???
> > Very grateful for any help!
> >
>
> Well, nothing wrong happened! Look here:
>
> >>> '\x40\x42\x8f\x5c'
> '@B\x8f\\'
> >>>
>
> So, '\x40' == '@'
> '\x42' == 'B'
> '\x5c' == '\\'
>
> -gus
Thanks for using your valuable time helping a python beginner!!
Just a little embarrassed that I did not see that. Like not finding my
glasses when they were.... at my head.. :-/
More information about the Python-list
mailing list