digitalmars.D - 16bit half floating point type as defined in IEEE-754r in D?
- s_lange (7/7) Nov 24 2009 A 16 bit precision floating point type has been defined by the IEEE in
- Andrei Alexandrescu (13/22) Nov 24 2009 D can store custom floating point types, see
A 16 bit precision floating point type has been defined by the IEEE in the revision of the 754 floating point standard and declared as optional. These small data types are heavily used in all kinds of graphics rendering software. The most prominent example beeing the gl libraries of the OpenGL specs. Are there any plans to support such a data type in future versions of D? regards Lange
Nov 24 2009
s_lange wrote:A 16 bit precision floating point type has been defined by the IEEE in the revision of the 754 floating point standard and declared as optional. These small data types are heavily used in all kinds of graphics rendering software. The most prominent example beeing the gl libraries of the OpenGL specs. Are there any plans to support such a data type in future versions of D? regards LangeD can store custom floating point types, see http://www.digitalmars.com/d/2.0/phobos/std_numeric.html where there's actually an example that creates the IEEE 16-bit float you mention: // Define a 16-bit floating point type alias CustomFloat!(1, 5, 10) HalfFloat; auto x = HalfFloat(0.125); assert(halfFloat.get!float == 0.125); But watch for: http://d.puremagic.com/issues/show_bug.cgi?id=3520 which hasn't been fixed yet. Or please fix it :o). Andrei
Nov 24 2009