[issue705836] struct.pack of floats in non-native endian order
Mark Dickinson
report at bugs.python.org
Sun Jan 20 06:10:51 CET 2008
Mark Dickinson added the comment:
Here's a patch that fixes the test that Collin mentioned to reflect what's actually been
happening for the last nearly 5 years, and changes _PyFloat_Pack4 and _PyFloat_Pack8, as
follows.
When packing a float that's too large for the destination format (e.g. pack(">f", 1e39)):
- before the patch, _PyFloat_Pack* gives an OverflowError on non-IEEE-754 platforms and
an IEEE infinity on IEEE-754 platforms.
- after the patch, _PyFloat_Pack* gives an IEEE infinity on all platforms.
This patch doesn't fix the problem that the cast from double to float on IEEE machines
involves potentially undefined behaviour; I think that should be considered a separate
issue.
Added file: http://bugs.python.org/file9240/705836.patch
____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue705836>
____________________________________
More information about the Python-bugs-list
mailing list