I wrote a float16/half-precision module here: https://github.com/m-paradox/numpy_half
I've tested it with NumPy 1.3.0 and the latest trunk. With it, you can do things like this: >>> import numpy as np, half as h >>> np.array([0,0.1,1.0/3.0], dtype='float16') array([ 0. , 0.09997559, 0.33325195], dtype=float16) >>> a = h.float16(1.5) >>> print a 1.5 >>> a.dtype dtype('float16') Many functions aren't implemented, so things like this don't work: >>> np.arange(10, dtype='float16') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: no fill-function for data-type. Also, because of bug #809, it looks like there's no way to nicely support '<f2' or '>f2'. >>> np.array([10], dtype='f2') array([ 10.], dtype=float16) >>> np.array([10], dtype='<f2') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: data type not understood What would need to be done to build it in as a supported NumPy data type? -Mark
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion