90 #if defined(OPENEXR_DLL)
91 #if defined(HALF_EXPORTS)
92 #define HALF_EXPORT __declspec(dllexport)
94 #define HALF_EXPORT __declspec(dllimport)
96 #define HALF_EXPORT_CONST
99 #define HALF_EXPORT_CONST const
118 operator float ()
const;
133 half & operator = (
float f);
136 half & operator += (
float f);
139 half & operator -= (
float f);
142 half & operator *= (
float f);
145 half & operator /= (
float f);
154 half round (
unsigned int n)
const;
178 bool isFinite ()
const;
179 bool isNormalized ()
const;
180 bool isDenormalized ()
const;
181 bool isZero ()
const;
183 bool isInfinity ()
const;
184 bool isNegative ()
const;
201 static half posInf ();
202 static half negInf ();
211 unsigned short bits ()
const;
212 void setBits (
unsigned short bits);
225 static short convert (
int i);
226 static float overflow ();
260 #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
262 #define HALF_MIN 5.96046448e-08f // Smallest positive half
264 #define HALF_NRM_MIN 6.10351562e-05f // Smallest positive normalized half
266 #define HALF_MAX 65504.0f // Largest positive half
268 #define HALF_EPSILON 0.00097656f // Smallest positive e for which
272 #define HALF_MIN 5.96046448e-08 // Smallest positive half
274 #define HALF_NRM_MIN 6.10351562e-05 // Smallest positive normalized half
276 #define HALF_MAX 65504.0 // Largest positive half
278 #define HALF_EPSILON 0.00097656 // Smallest positive e for which
283 #define HALF_MANT_DIG 11 // Number of digits in mantissa
286 #define HALF_DIG 2 // Number of base 10 digits that
289 #define HALF_RADIX 2 // Base of the exponent
291 #define HALF_MIN_EXP -13 // Minimum negative integer such that
296 #define HALF_MAX_EXP 16 // Maximum positive integer such that
301 #define HALF_MIN_10_EXP -4 // Minimum positive integer such
305 #define HALF_MAX_10_EXP 4 // Maximum positive integer such
471 register int e = (x.
i >> 23) & 0x000001ff;
482 register int m = x.
i & 0x007fffff;
483 _h = e + ((m + 0x00000fff + ((m >> 13) & 1)) >> 13);
502 half::operator float ()
const
504 return _toFloat[_h].f;
527 unsigned short s = _h & 0x8000;
528 unsigned short e = _h & 0x7fff;
599 *
this =
half (
float (*
this) +
float (h));
607 *
this =
half (
float (*
this) + f);
615 *
this =
half (
float (*
this) -
float (h));
623 *
this =
half (
float (*
this) - f);
631 *
this =
half (
float (*
this) *
float (h));
639 *
this =
half (
float (*
this) * f);
647 *
this =
half (
float (*
this) /
float (h));
655 *
this =
half (
float (*
this) / f);
663 unsigned short e = (_h >> 10) & 0x001f;
671 unsigned short e = (_h >> 10) & 0x001f;
672 return e > 0 && e < 31;
679 unsigned short e = (_h >> 10) & 0x001f;
680 unsigned short m = _h & 0x3ff;
681 return e == 0 && m != 0;
688 return (_h & 0x7fff) == 0;
695 unsigned short e = (_h >> 10) & 0x001f;
696 unsigned short m = _h & 0x3ff;
697 return e == 31 && m != 0;
704 unsigned short e = (_h >> 10) & 0x001f;
705 unsigned short m = _h & 0x3ff;
706 return e == 31 && m == 0;
713 return (_h & 0x8000) != 0;
753 inline unsigned short
half & operator*=(half h)
bool isDenormalized() const
istream & operator>>(istream &s, PHTimeStamp &t)
bool isNormalized() const
half & operator/=(half h)
half round(unsigned int n) const
PHTimeStamp operator-(const PHTimeStamp &t1, time_t t2)
std::basic_ostream< E, T > & operator<<(std::basic_ostream< E, T > &os, shared_ptr< Y > const &p)
half & operator+=(half h)
#define HALF_EXPORT_CONST
HALF_EXPORT void printBits(std::ostream &os, half h)
void setBits(unsigned short bits)
unsigned short bits() const
half & operator-=(half h)