[Numpy-discussion] Float16 and PEP 3118

Pauli Virtanen pav at iki.fi
Thu Dec 2 13:16:47 EST 2010


Thu, 02 Dec 2010 10:20:27 -0700, Charles R Harris wrote:
> Now that the float16 type is in I was wondering if we should do anything
> to support it in the PEP 3118 buffer interface. This would probably
> affect the Cython folks as well as the people working on fixing up the
> structure module <http://bugs.python.org/issue3132>for Python 3.x. 

Before introducing a PEP 3118 type code for half floats in the PEP, one 
would need to argue the Python people to add it to the struct module.

Before that, the choices probably are:

- refuse to export buffers containing half floats

- export half floats as two bytes

> There is a fairly long thread about the latter and it also looks like
> what the Python folks are doing with structure alignment isn't going to
> be compatible with Numpy structured arrays. Thoughts?

I think it would be useful for the Python people to have feedback from us 
here.

AFAIK, the native-aligned mode that was discussed there is compatible 
with what dtype(..., align=True) produces: Numpy aligns structs as given 
by the maximum alignment of its fields.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list