109 constexpr
half (
const half &) noexcept =
default;
110 constexpr
half (
half &&) noexcept =
default;
116 operator float ()
const;
224 GF_API static short convert (
int i);
225 GF_API static float overflow ();
229 GF_API static const uif _toFloat[1 << 16];
230 GF_API static const unsigned short _eLut[1 << 9];
261 #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
263 #define PXR_HALF_MIN 5.96046448e-08f // Smallest positive half
265 #define PXR_HALF_NRM_MIN 6.10351562e-05f // Smallest positive normalized half
267 #define PXR_HALF_MAX 65504.0f // Largest positive half
269 #define PXR_HALF_EPSILON 0.00097656f // Smallest positive e for which
273 #define PXR_HALF_MIN 5.96046448e-08 // Smallest positive half
275 #define PXR_HALF_NRM_MIN 6.10351562e-05 // Smallest positive normalized half
277 #define PXR_HALF_MAX 65504.0 // Largest positive half
279 #define PXR_HALF_EPSILON 0.00097656 // Smallest positive e for which
284 #define PXR_HALF_MANT_DIG 11 // Number of digits in mantissa
289 #define PXR_HALF_DIG 3 // Number of base 10 digits that
293 #define PXR_HALF_DECIMAL_DIG 5 // Number of base-10 digits that are
297 #define PXR_HALF_RADIX 2 // Base of the exponent
299 #define PXR_HALF_MIN_EXP -13 // Minimum negative integer such that
304 #define PXR_HALF_MAX_EXP 16 // Maximum positive integer such that
309 #define PXR_HALF_MIN_10_EXP -4 // Minimum positive integer such
313 #define PXR_HALF_MAX_10_EXP 4 // Maximum positive integer such
468 int e = (x.
i >> 23) & 0x000001ff;
479 int m = x.
i & 0x007fffff;
480 _h = e + ((m + 0x00000fff + ((m >> 13) & 1)) >> 13);
501 return _toFloat[_h].f;
524 unsigned short s = _h & 0x8000;
525 unsigned short e = _h & 0x7fff;
588 *
this =
half (
float (*
this) +
float (h));
596 *
this =
half (
float (*
this) + f);
604 *
this =
half (
float (*
this) -
float (h));
612 *
this =
half (
float (*
this) - f);
620 *
this =
half (
float (*
this) *
float (h));
628 *
this =
half (
float (*
this) * f);
636 *
this =
half (
float (*
this) /
float (h));
644 *
this =
half (
float (*
this) / f);
652 unsigned short e = (_h >> 10) & 0x001f;
660 unsigned short e = (_h >> 10) & 0x001f;
661 return e > 0 && e < 31;
668 unsigned short e = (_h >> 10) & 0x001f;
669 unsigned short m = _h & 0x3ff;
670 return e == 0 && m != 0;
677 return (_h & 0x7fff) == 0;
684 unsigned short e = (_h >> 10) & 0x001f;
685 unsigned short m = _h & 0x3ff;
686 return e == 31 && m != 0;
693 unsigned short e = (_h >> 10) & 0x001f;
694 unsigned short m = _h & 0x3ff;
695 return e == 31 && m == 0;
702 return (_h & 0x8000) != 0;
742 inline unsigned short
GF_API std::istream & operator>>(std::istream &is, half &h)
half & operator-=(half h)
GF_API unsigned short bits() const
half & operator+=(half h)
GF_API std::ostream & operator<<(std::ostream &os, half h)
GF_API void printBits(std::ostream &os, half h)
IMATH_NAMESPACE::V2f float
half & operator/=(half h)
bool isDenormalized() const
half round(unsigned int n) const
GLfloat GLfloat GLfloat GLfloat h
half & operator=(const half &h)=default
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
bool isNormalized() const
half & operator*=(half h)
GF_API void setBits(unsigned short bits)