Mark Dickinson <dicki...@gmail.com> added the comment: [Robert] > I have to disagree. It seems entirely reasonable to expect that > unpack should return the same value passed to pack.
Robert: notice that a *Python* float (a *64-bit* C double internally) is here being stored as a *32-bit* float, losing precision. So no, it's not at all reasonable to expect that unpack should return the same value passed to pack---it's mathematically impossible for it to do so. There are (around) 2**64 distinct Python floats, and only 2**32 ways to pack them using '<f'. When packing / unpacking using '<d', it *is* reasonable to expect the value to be recovered exactly, and as far as I know that's always what happens (barring peculiarities like NaN payloads not being reproduced exactly). ---------- _______________________________________ 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