[issue11734] Add half-float (16-bit) support to struct module

Eli Stevens report at bugs.python.org
Tue Apr 5 12:10:31 CEST 2011


Eli Stevens <wickedgrey at gmail.com> added the comment:

Made the _PyFloat_Pack2 match the algo in _PyFloat_Pack4, and did similar for Unpack.  This should work on platforms that don't have IEEE 754 floats except for situations where an INF or NAN is unpacked (this is the same as the Unpack4 behavior).

This also gets rid of any need for #ifdef'd code (an ad-hoc speed test showed no noticeable difference between the numpy-based version and the CPython-based version of the functions).

I've also added a bit of documentation to this version, as well as more tests.

I haven't changed anything about the native_table entry or Pack4's non-round-to-even behavior.

----------
Added file: http://bugs.python.org/file21540/cpython-struct-float16-v4.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11734>
_______________________________________


More information about the Python-bugs-list mailing list