[Numpy-discussion] Does float16 exist?

Bill Baxter wbaxter at gmail.com
Tue Jan 8 15:58:05 EST 2008


If you're really going to try to do it, Charles, there's an
implementation of float16 in the OpenEXR toolkit.
http://www.openexr.com/

Or more precisely it's in the files in the Half/ directory of this:
http://download.savannah.nongnu.org/releases/openexr/ilmbase-1.0.1.tar.gz

I don't know if it's IEEE conformant or not (especially w.r.t. NaN's
and such) but it should be a good start.  The code seems to be well
documented.

--bb

On Jan 9, 2008 5:24 AM, Charles R Harris <charlesr.harris at gmail.com> wrote:
>
>
>
> On Jan 8, 2008 1:09 PM, Anne Archibald <peridot.faceted at gmail.com> wrote:
> >
> > On 08/01/2008, Charles R Harris <charlesr.harris at 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.
> >
>
> Sure, but where's the fun in that? Besides, I think that adding a data type
> might be an opportunity to generate a detailed road map for future projects
> that might actually matter (quads and decimal floats for money stuff), and
> might provide a chance to revisit some code and see if it can be simplified.
> It's tough to get up the motivation to do that without some other prod.
> Besides, it's new and I have a weakness for new stuff.
>
>
> >
> > 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.
>
> I would plan on at least arithmetic. Adding special functions probably ain't
> worth it and even now a lot of things are done by promoting things to floats
> or doubles and calling routines in LAPACK.
>
> Chuck
>
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>



More information about the NumPy-Discussion mailing list