110 operator float ()
const;
224 HALF_EXPORT static const unsigned short _eLut[1 << 9];
255 #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
257 #define HALF_MIN 5.96046448e-08f // Smallest positive half
259 #define HALF_NRM_MIN 6.10351562e-05f // Smallest positive normalized half
261 #define HALF_MAX 65504.0f // Largest positive half
263 #define HALF_EPSILON 0.00097656f // Smallest positive e for which
267 #define HALF_MIN 5.96046448e-08 // Smallest positive half
269 #define HALF_NRM_MIN 6.10351562e-05 // Smallest positive normalized half
271 #define HALF_MAX 65504.0 // Largest positive half
273 #define HALF_EPSILON 0.00097656 // Smallest positive e for which
278 #define HALF_MANT_DIG 11 // Number of digits in mantissa
283 #define HALF_DIG 3 // Number of base 10 digits that
287 #define HALF_DECIMAL_DIG 5 // Number of base-10 digits that are
291 #define HALF_RADIX 2 // Base of the exponent
293 #define HALF_MIN_EXP -13 // Minimum negative integer such that
298 #define HALF_MAX_EXP 16 // Maximum positive integer such that
303 #define HALF_MIN_10_EXP -4 // Minimum positive integer such
307 #define HALF_MAX_10_EXP 4 // Maximum positive integer such
462 int e = (x.
i >> 23) & 0x000001ff;
473 int m = x.
i & 0x007fffff;
474 _h = e + ((m + 0x00000fff + ((m >> 13) & 1)) >> 13);
493 half::operator float ()
const
495 return _toFloat[_h].f;
518 unsigned short s = _h & 0x8000;
519 unsigned short e = _h & 0x7fff;
582 *
this =
half (
float (*
this) +
float (h));
590 *
this =
half (
float (*
this) + f);
598 *
this =
half (
float (*
this) -
float (h));
606 *
this =
half (
float (*
this) - f);
614 *
this =
half (
float (*
this) *
float (h));
622 *
this =
half (
float (*
this) * f);
630 *
this =
half (
float (*
this) /
float (h));
638 *
this =
half (
float (*
this) / f);
646 unsigned short e = (_h >> 10) & 0x001f;
654 unsigned short e = (_h >> 10) & 0x001f;
655 return e > 0 && e < 31;
662 unsigned short e = (_h >> 10) & 0x001f;
663 unsigned short m = _h & 0x3ff;
664 return e == 0 && m != 0;
671 return (_h & 0x7fff) == 0;
678 unsigned short e = (_h >> 10) & 0x001f;
679 unsigned short m = _h & 0x3ff;
680 return e == 31 && m != 0;
687 unsigned short e = (_h >> 10) & 0x001f;
688 unsigned short m = _h & 0x3ff;
689 return e == 31 && m == 0;
696 return (_h & 0x8000) != 0;
736 inline unsigned short
half & operator*=(half h)
bool isDenormalized() const
bool isNormalized() const
half & operator/=(half h)
HALF_EXPORT std::istream & operator>>(std::istream &is, half &h)
half & operator=(const half &h)=default
half round(unsigned int n) const
GLint GLint GLint GLint GLint x
HALF_EXPORT std::ostream & operator<<(std::ostream &os, half h)
half & operator+=(half h)
GLfloat GLfloat GLfloat GLfloat h
HALF_EXPORT void printBits(std::ostream &os, half h)
HALF_EXPORT void setBits(unsigned short bits)
HALF_EXPORT unsigned short bits() const
half & operator-=(half h)