[Numpy-discussion] Does float16 exist?

Anne Archibald peridot.faceted@gmail....
Tue Jan 8 14:09:53 CST 2008


On 08/01/2008, Charles R Harris <charlesr.harris@gmail.com> wrote:

> Well, at a minimum people will want to read, write, print, and promote them.
> That would at least let people work with the numbers, and since my
> understanding is that the main virtue of the format is compactness for
> storage and communication, a basic need will be filled right there. One
> potential problem I see is handling +/-inf and nans, tests for these should
> probably be built into the type.

The el-cheapo solution to this simply provides two functions: take an
int16 array (which actually contains float16) and produce a float32
array, and vice versa. Then people do all their work in float32 (or
float64 is float32  doesn't have inf/nan, I don't remember) but can
read and write float16.

Of course it would be nicer to use flaot16 natively, more or less, but
without all the math that's going to be a frustrating experience.

Anne


More information about the Numpy-discussion mailing list