TD22057 <[EMAIL PROTECTED]> added the comment:

I'm receiving a 32 bit floating point number encoded in binary format. 
The correct value for that number is 1.8183e-7 which can be expressed in
single precision just fine.  Given that the number in the binary
encoding is 1.8183e-7, I expected to get that back, not
1.818300034983622e-07 (which is NOT the closest double precision number
to the actual single precision number).

After doing some experiments, I think the problem is a basic fact of
life in C code which is that casting that single precision value to a
double precision one does not specify what happens in the extra digits.
 So I'm getting garbage in the extra digits when the struct module C
code casts the single to a double.  The problem is that C doesn't assume
that the non-precise digits are zero.

Since this is a function of the underlying C language, I'll withdraw the
bug.  (Hmm - I don't seem to have permission to do that)

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4114>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to