Ptex

Halfprecision (16bit) floatingpoint type. More...
#include <PtexHalf.h>
Public Member Functions  
PtexHalf ()  
Default constructor, value is undefined. More...  
PtexHalf (float val)  
PtexHalf (double val)  
operator float () const  
PtexHalf &  operator= (float val) 
Static Public Member Functions  
static float  toFloat (uint16_t h) 
static uint16_t  fromFloat (float val) 
Public Attributes  
uint16_t  bits 
Static Private Member Functions  
static uint16_t  fromFloat_except (uint32_t val) 
Handle exceptional cases for halftofloat conversion. More...  
Static Private Attributes  
static uint32_t  h2fTable [65536] 
static uint16_t  f2hTable [512] 
Halfprecision (16bit) floatingpoint type.
This type should be compatible with opengl, openexr, and IEEE 754r. The range is [65504.0, 65504.0] and the precision is about 1 part in 2000 (3.3 decimal places).
From OpenGL spec 2.1.2:
A 16bit floatingpoint number has a 1bit sign (S), a 5bit exponent (E), and a 10bit mantissa (M). The value of a 16bit floatingpoint number is determined by the following:
(1)^S * 0.0, if E == 0 and M == 0, (1)^S * 2^14 * (M/2^10), if E == 0 and M != 0, (1)^S * 2^(E15) * (1 + M/2^10), if 0 < E < 31, (1)^S * INF, if E == 31 and M == 0, or NaN, if E == 31 and M != 0
Definition at line 88 of file PtexHalf.h.

inline 
Default constructor, value is undefined.
Definition at line 92 of file PtexHalf.h.

inline 
Definition at line 93 of file PtexHalf.h.

inline 
Definition at line 94 of file PtexHalf.h.

inlinestatic 
Definition at line 105 of file PtexHalf.h.
References f2hTable, and fromFloat_except().
Referenced by operator=().

staticprivate 
Handle exceptional cases for halftofloat conversion.
Definition at line 44 of file PtexHalf.cpp.
Referenced by fromFloat().

inline 
Definition at line 95 of file PtexHalf.h.

inline 
Definition at line 96 of file PtexHalf.h.
References bits, and fromFloat().

inlinestatic 
uint16_t PtexHalf::bits 
Definition at line 89 of file PtexHalf.h.
Referenced by operator float(), and operator=().

staticprivate 
Definition at line 121 of file PtexHalf.h.
Referenced by fromFloat().

staticprivate 
Definition at line 120 of file PtexHalf.h.
Referenced by toFloat().