Robert Withrow <bigbaaad...@gmail.com> added the comment:

I have to disagree.  It seems entirely reasonable to expect that unpack should 
return the same value passed to pack.  That it doesn't (as of 2.6.5 at least) 
is completely unexpected and undocumented.  And yes I understand the 
limitations of floating point numbers.

I suggest that struct should be fixed so that 
struct.unpack(fmt,struct.pack(fmt,v)) == v and format is something like '!f'.

This can be done in C code (I do it) for IEEE 754 floats.

At the very list this unexpected behavior should be documented in struct.

----------
nosy: +Robert.Withrow

_______________________________________
Python tracker <rep...@bugs.python.org>
<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