
On Fri, Mar 25, 2011 at 10:21 AM, Pauli Virtanen <pav@iki.fi> wrote:
Fri, 25 Mar 2011 10:00:24 -0700, Eli Stevens (Gmail) wrote:
I'm working on getting support for 16-bit floats into cython and have run into what seems like a numpy bug (I'm a new contributor to both projects, so bear with me ;).
https://github.com/wickedgrey/numpy/ commit/29f9f1b709cc2c346b8514859c58a761df80f031
Adding NPY_HALF to the switch statement on line 350 of numpy/core/src/multiarray/buffer.c doesn't seem controversial (unless it needs to be spelled NPY_FLOAT16 or something similar), but I have no idea how to test the change.
The buffer interface cannot be used to export the half-float types, since the type is not specified in PEP 3118. Numpy cannot unilaterally add nonstandard format codes to the spec.
That said, I think starting a discussion with the Python core developers about the float16 type is worthwhile. There might be interest in supporting the float16 type in the struct interface, something that would be required as part of amending PEP 3118. -Mark