HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fpreal16.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
4 // Digital Ltd. LLC
5 //
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are
10 // met:
11 // * Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 // * Redistributions in binary form must reproduce the above
14 // copyright notice, this list of conditions and the following disclaimer
15 // in the documentation and/or other materials provided with the
16 // distribution.
17 // * Neither the name of Industrial Light & Magic nor the names of
18 // its contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 //
33 ///////////////////////////////////////////////////////////////////////////
34 
35 // Primary authors:
36 // Florian Kainz <kainz@ilm.com>
37 // Rod Bogart <rgb@ilm.com>
38 
39 //---------------------------------------------------------------------------
40 //
41 // fpreal16 -- a 16-bit floating point number class:
42 //
43 // Type fpreal16 can represent positive and negative numbers, whose
44 // magnitude is between roughly 6.1e-5 and 6.5e+4, with a relative
45 // error of 9.8e-4; numbers smaller than 6.1e-5 can be represented
46 // with an absolute error of 6.0e-8. All integers from -2048 to
47 // +2048 can be represented exactly.
48 //
49 // Type fpreal16 behaves (almost) like the built-in C++ floating point
50 // types. In arithmetic expressions, fpreal16, float and double can be
51 // mixed freely. Here are a few examples:
52 //
53 // fpreal16 a (3.5);
54 // float b (a + sqrt (a));
55 // a += b;
56 // b += a;
57 // b = a + 7;
58 //
59 // Conversions from fpreal16 to float are lossless; all fpreal16 numbers
60 // are exactly representable as floats.
61 //
62 // Conversions from float to fpreal16 may not preserve the float's
63 // value exactly. If a float is not representable as a fpreal16, the
64 // float value is rounded to the nearest representable fpreal16. If
65 // a float value is exactly in the middle between the two closest
66 // representable fpreal16 values, then the float value is rounded to
67 // the fpreal16 with the greater magnitude.
68 //
69 // Overflows during float-to-fpreal16 conversions cause arithmetic
70 // exceptions. An overflow occurs when the float value to be
71 // converted is too large to be represented as a fpreal16, or if the
72 // float value is an infinity or a NAN.
73 //
74 // The implementation of type fpreal16 makes the following assumptions
75 // about the implementation of the built-in C++ types:
76 //
77 // float is an IEEE 754 single-precision number
78 // sizeof (float) == 4
79 // sizeof (unsigned int) == sizeof (float)
80 // alignof (unsigned int) == alignof (float)
81 // sizeof (unsigned short) == 2
82 //
83 //---------------------------------------------------------------------------
84 
85 #ifndef _H_REAL16_H_
86 #define _H_REAL16_H_
87 
88 #include "SYS_API.h"
89 #ifndef __SYS_Types__
90 #error This file must be included from SYS_Types.h
91 #endif
92 
93 #include "SYS_Deprecated.h"
94 #include "SYS_Inline.h"
95 #include "SYS_TypeDecorate.h"
96 #include <iosfwd>
97 
98 // MSVC doesn't define __F16C__ implicitly when AVX2 is enabled, so catch it
99 // here
100 #if defined(__F16C__) || defined(__AVX2__)
101  #if defined(_WIN32)
102  #include <intrin.h>
103  #else
104  #include <immintrin.h>
105  #endif
106 
107  #define SYS_USE_F16C
108 #endif
109 
111 {
112  public:
113 
114  //-------------
115  // Constructors
116  //-------------
117 
118  fpreal16() = default; // no initialization
119  fpreal16(const fpreal16 &h) = default;
121 
122 
123  //--------------------
124  // Conversion to float
125  //--------------------
126 
127  operator fpreal32() const;
128 
129 
130  //------------
131  // Unary minus
132  //------------
133 
134  fpreal16 operator-() const;
135 
136 
137  //-----------
138  // Assignment
139  //-----------
140 
141  fpreal16 &operator=(const fpreal16 &h) = default;
143 
146 
149 
152 
155 
156 
157  //---------------------------------------------------------
158  // Round to n-bit precision (n should be between 0 and 10).
159  // After rounding, the significand's 10-n least significant
160  // bits will be zero.
161  //---------------------------------------------------------
162 
163  fpreal16 round(unsigned int n) const;
164 
165 
166  //--------------------------------------------------------------------
167  // Classification:
168  //
169  // h.isFinite() returns true if h is a normalized number,
170  // a denormalized number or zero
171  //
172  // h.isNormalized() returns true if h is a normalized number
173  //
174  // h.isDenormalized() returns true if h is a denormalized number
175  //
176  // h.isZero() returns true if h is zero
177  //
178  // h.isNan() returns true if h is a NAN
179  //
180  // h.isInfinity() returns true if h is a positive
181  // or a negative infinity
182  //
183  // h.isNegative() returns true if the sign bit of h
184  // is set (negative)
185  //--------------------------------------------------------------------
186 
187  bool isFinite() const;
188  bool isNormalized() const;
189  bool isDenormalized() const;
190  bool isZero() const;
191  bool isNan() const;
192  bool isInfinity() const;
193  bool isNegative() const;
194 
195 
196  //--------------------------------------------
197  // Special values
198  //
199  // posInf() returns +infinity
200  //
201  // negInf() returns +infinity
202  //
203  // qNan() returns a NAN with the bit
204  // pattern 0111111111111111
205  //
206  // sNan() returns a NAN with the bit
207  // pattern 0111110111111111
208  //--------------------------------------------
209 
210  static fpreal16 posInf();
211  static fpreal16 negInf();
212  static fpreal16 qNan();
213  static fpreal16 sNan();
214 
215 
216  //--------------------------------------
217  // Access to the internal representation
218  //--------------------------------------
219 
220  unsigned short bits() const;
221  void setBits(unsigned short bits);
222 
223 
224  static void ensureStaticDataIsInitialized();
225 
226  public:
227 
228  union uif
229  {
232  };
233 
234  private:
235 
236  static int16 convert(int i);
237  static fpreal32 overflow();
238 
239  unsigned short _h;
240 
241  protected:
242  static bool selftest();
243  static const uif *_toFloat;
244  static const unsigned short *_eLut;
245  static bool _itWorks;
246 };
247 
248 
249 //-----------
250 // Type Traits Compatibility
251 //-----------
252 
255 
256 
257 //-----------
258 // Stream I/O
259 //-----------
260 
261 SYS_API extern std::ostream & operator << (std::ostream &os, fpreal16 h);
262 SYS_API extern std::istream & operator >> (std::istream &is, fpreal16 &h);
263 
264 
265 //----------
266 // Debugging
267 //----------
268 
269 SYS_API extern void SYSprintBits (std::ostream &os, fpreal16 h);
270 SYS_API extern void SYSprintBits (std::ostream &os, fpreal32 f);
271 SYS_API extern void SYSprintBits (char c[19], fpreal16 h);
272 SYS_API extern void SYSprintBits (char c[35], fpreal32 f);
273 
274 
275 //-------
276 // Limits
277 //-------
278 
279 #define H_REAL16_MIN 5.96046448e-08 // Smallest +ve fpreal16
280 #define H_REAL16_NRM_MIN 6.10351562e-05 // Smallest +ve normalized fpreal16
281 
282 #define H_REAL16_MAX 65504.0 // Largest positive fpreal16
283 
284 // Smallest positive e for which fpreal16 (1.0 + e) != fpreal16 (1.0)
285 #define H_REAL16_EPSILON 0.00097656
286 
287 #define H_REAL16_MANT_DIG 11 // Number of digits in mantissa
288  // (significand + hidden leading 1)
289 
290 #define H_REAL16_DIG 2 // Number of base 10 digits that
291  // can be represented without change
292 
293 #define H_REAL16_RADIX 2 // Base of the exponent
294 
295 #define H_REAL16_MIN_EXP -13 // Minimum negative integer such that
296  // H_REAL16_RADIX raised to the power of
297  // one less than that integer is a
298  // normalized fpreal16
299 
300 #define H_REAL16_MAX_EXP 16 // Maximum positive integer such that
301  // H_REAL16_RADIX raised to the power of
302  // one less than that integer is a
303  // normalized fpreal16
304 
305 #define H_REAL16_MIN_10_EXP -4 // Minimum positive integer such
306  // that 10 raised to that power is
307  // a normalized fpreal16
308 
309 #define H_REAL16_MAX_10_EXP 4 // Maximum positive integer such
310  // that 10 raised to that power is
311  // a normalized fpreal16
312 
313 
314 //---------------------------------------------------------------------------
315 //
316 // Implementation --
317 //
318 // Representation of a float:
319 //
320 // We assume that a float, f, is an IEEE 754 single-precision
321 // floating point number, whose bits are arranged as follows:
322 //
323 // 31 (msb)
324 // |
325 // | 30 23
326 // | | |
327 // | | | 22 0 (lsb)
328 // | | | | |
329 // X XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
330 //
331 // s e m
332 //
333 // S is the sign-bit, e is the exponent and m is the significand.
334 //
335 // If e is between 1 and 254, f is a normalized number:
336 //
337 // s e-127
338 // f = (-1) * 2 * 1.m
339 //
340 // If e is 0, and m is not zero, f is a denormalized number:
341 //
342 // s -126
343 // f = (-1) * 2 * 0.m
344 //
345 // If e and m are both zero, f is zero:
346 //
347 // f = 0.0
348 //
349 // If e is 255, f is an "infinity" or "not a number" (NAN),
350 // depending on whether m is zero or not.
351 //
352 // Examples:
353 //
354 // 0 00000000 00000000000000000000000 = 0.0
355 // 0 01111110 00000000000000000000000 = 0.5
356 // 0 01111111 00000000000000000000000 = 1.0
357 // 0 10000000 00000000000000000000000 = 2.0
358 // 0 10000000 10000000000000000000000 = 3.0
359 // 1 10000101 11110000010000000000000 = -124.0625
360 // 0 11111111 00000000000000000000000 = +infinity
361 // 1 11111111 00000000000000000000000 = -infinity
362 // 0 11111111 10000000000000000000000 = NAN
363 // 1 11111111 11111111111111111111111 = NAN
364 //
365 // Representation of a fpreal16:
366 //
367 // Here is the bit-layout for a fpreal16 number, h:
368 //
369 // 15 (msb)
370 // |
371 // | 14 10
372 // | | |
373 // | | | 9 0 (lsb)
374 // | | | | |
375 // X XXXXX XXXXXXXXXX
376 //
377 // s e m
378 //
379 // S is the sign-bit, e is the exponent and m is the significand.
380 //
381 // If e is between 1 and 30, h is a normalized number:
382 //
383 // s e-15
384 // h = (-1) * 2 * 1.m
385 //
386 // If e is 0, and m is not zero, h is a denormalized number:
387 //
388 // S -14
389 // h = (-1) * 2 * 0.m
390 //
391 // If e and m are both zero, h is zero:
392 //
393 // h = 0.0
394 //
395 // If e is 31, h is an "infinity" or "not a number" (NAN),
396 // depending on whether m is zero or not.
397 //
398 // Examples:
399 //
400 // 0 00000 0000000000 = 0.0
401 // 0 01110 0000000000 = 0.5
402 // 0 01111 0000000000 = 1.0
403 // 0 10000 0000000000 = 2.0
404 // 0 10000 1000000000 = 3.0
405 // 1 10101 1111000001 = -124.0625
406 // 0 11111 0000000000 = +infinity
407 // 1 11111 0000000000 = -infinity
408 // 0 11111 1000000000 = NAN
409 // 1 11111 1111111111 = NAN
410 //
411 // Conversion:
412 //
413 // Converting from a float to a fpreal16 requires some non-trivial bit
414 // manipulations. In some cases, this makes conversion relatively
415 // slow, but the most common case is accelerated via table lookups.
416 //
417 // Converting back from a fpreal16 to a float is easier because we don't
418 // have to do any rounding. In addition, there are only 65536
419 // different fpreal16 numbers; we can convert each of those numbers once
420 // and store the results in a table. Later, all conversions can be
421 // done using only simple table lookups.
422 //
423 //---------------------------------------------------------------------------
424 
425 
426 //----------------------------
427 // fpreal16-from-float constructor
428 //----------------------------
429 
432 {
433 #if defined(SYS_USE_F16C)
434  #ifdef _MSC_VER
435  // msvc does not seem to have cvtsh_ss :(
436  _h = _mm_extract_epi16 (
437  _mm_cvtps_ph (
438  _mm_set_ss (f), (_MM_FROUND_TO_NEAREST_INT)),
439  0);
440  #else
441  // preserve the fixed rounding mode to nearest
442  _h = _cvtss_sh (f, (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC));
443  #endif
444 #else
445  if (f == 0)
446  {
447  //
448  // Common special case - zero.
449  // For speed, we don't preserve the zero's sign.
450  //
451 
452  _h = 0;
453  }
454  else
455  {
456  //
457  // We extract the combined sign and exponent, e, from our
458  // floating-point number, f. Then we convert e to the sign
459  // and exponent of the fpreal16 number via a table lookup.
460  //
461  // For the most common case, where a normalized fpreal16 is produced,
462  // the table lookup returns a non-zero value; in this case, all
463  // we have to do, is round f's significand to 10 bits and combine
464  // the result with e.
465  //
466  // For all other cases (overflow, zeroes, denormalized numbers
467  // resulting from underflow, infinities and NANs), the table
468  // lookup returns zero, and we call a longer, non-inline function
469  // to do the float-to-fpreal16 conversion.
470  //
471 
472  uif x;
473 
474  x.f = f;
475 
476  int e = (x.i >> 23) & 0x000001ff;
477 
478  e = _eLut[e];
479 
480  if (e)
481  {
482  //
483  // Simple case - round the significand and
484  // combine it with the sign and exponent.
485  //
486 
487  _h = e + (((x.i & 0x007fffff) + 0x00001000) >> 13);
488  }
489  else
490  {
491  //
492  // Difficult case - call a function.
493  //
494 
495  _h = convert (x.i);
496  }
497  }
498 #endif
499 }
500 
501 
502 //------------------------------------------
503 // fpreal16-to-float conversion via table lookup
504 //------------------------------------------
505 
507 fpreal16::operator fpreal32() const
508 {
509 #if defined(SYS_USE_F16C)
510  // NB: The intel implementation does seem to treat NaN slightly
511  // different than the original toFloat table does (i.e. where the
512  // 1 bits are, meaning the signalling or not bits). This seems
513  // benign, given that the original library didn't really deal with
514  // signalling vs non-signalling NaNs
515  #ifdef _MSC_VER
516  /* msvc does not seem to have cvtsh_ss :( */
517  return _mm_cvtss_f32 (_mm_cvtph_ps (_mm_set1_epi16 (_h)));
518  #else
519  return _cvtsh_ss (_h);
520  #endif
521 #else
522  return _toFloat[_h].f;
523 #endif
524 }
525 
526 //-------------------------
527 // Round to n-bit precision
528 //-------------------------
529 
530 inline fpreal16
531 fpreal16::round(unsigned int n) const
532 {
533  //
534  // Parameter check.
535  //
536 
537  if (n >= 10)
538  return *this;
539 
540  //
541  // Disassemble h into the sign, s,
542  // and the combined exponent and significand, e.
543  //
544 
545  unsigned short s = _h & 0x8000;
546  unsigned short e = _h & 0x7fff;
547 
548  //
549  // Round the exponent and significand to the nearest value
550  // where ones occur only in the (10-n) most significant bits.
551  // Note that the exponent adjusts automatically if rounding
552  // up causes the significand to overflow.
553  //
554 
555  e >>= 9 - n;
556  e += e & 1;
557  e <<= 9 - n;
558 
559  //
560  // Check for exponent overflow.
561  //
562 
563  if (e >= 0x7c00)
564  {
565  //
566  // Overflow occurred -- truncate instead of rounding.
567  //
568 
569  e = _h;
570  e >>= 10 - n;
571  e <<= 10 - n;
572  }
573 
574  //
575  // Put the original sign bit back.
576  //
577 
578  fpreal16 h;
579  h._h = s | e;
580 
581  return h;
582 }
583 
584 
585 //-----------------------
586 // Other inline functions
587 //-----------------------
588 
591 {
592  fpreal16 h;
593  h._h = _h ^ 0x8000;
594  return h;
595 }
596 
597 
600 {
601  *this = fpreal16 (f);
602  return *this;
603 }
604 
605 
606 inline fpreal16
608 {
609  *this = fpreal16 (fpreal32(*this) + fpreal32(h));
610  return *this;
611 }
612 
613 
614 inline fpreal16
616 {
617  *this = fpreal16 (fpreal32(*this) + f);
618  return *this;
619 }
620 
621 
622 inline fpreal16
624 {
625  *this = fpreal16 (fpreal32(*this) - fpreal32(h));
626  return *this;
627 }
628 
629 
630 inline fpreal16
632 {
633  *this = fpreal16 (fpreal32 (*this) - f);
634  return *this;
635 }
636 
637 
638 inline fpreal16
640 {
641  *this = fpreal16 (fpreal32 (*this) * fpreal32 (h));
642  return *this;
643 }
644 
645 
646 inline fpreal16
648 {
649  *this = fpreal16 (fpreal32 (*this) * f);
650  return *this;
651 }
652 
653 
654 inline fpreal16
656 {
657  *this = fpreal16 (fpreal32 (*this) / fpreal32 (h));
658  return *this;
659 }
660 
661 
662 inline fpreal16
664 {
665  *this = fpreal16 (fpreal32 (*this) / f);
666  return *this;
667 }
668 
669 
670 SYS_FORCE_INLINE bool
672 {
673  unsigned short e = (_h >> 10) & 0x001f;
674  return e < 31;
675 }
676 
677 
678 SYS_FORCE_INLINE bool
680 {
681  unsigned short e = (_h >> 10) & 0x001f;
682  return e > 0 && e < 31;
683 }
684 
685 
686 SYS_FORCE_INLINE bool
688 {
689  unsigned short e = (_h >> 10) & 0x001f;
690  unsigned short m = _h & 0x3ff;
691  return e == 0 && m != 0;
692 }
693 
694 
695 SYS_FORCE_INLINE bool
697 {
698  return (_h & 0x7fff) == 0;
699 }
700 
701 
702 SYS_FORCE_INLINE bool
704 {
705  unsigned short e = (_h >> 10) & 0x001f;
706  unsigned short m = _h & 0x3ff;
707  return e == 31 && m != 0;
708 }
709 
710 
711 SYS_FORCE_INLINE bool
713 {
714  unsigned short e = (_h >> 10) & 0x001f;
715  unsigned short m = _h & 0x3ff;
716  return e == 31 && m == 0;
717 }
718 
719 
720 SYS_FORCE_INLINE bool
722 {
723  return (_h & 0x8000) != 0;
724 }
725 
726 
729 {
730  fpreal16 h;
731  h._h = 0x7c00;
732  return h;
733 }
734 
735 
738 {
739  fpreal16 h;
740  h._h = 0xfc00;
741  return h;
742 }
743 
744 
747 {
748  fpreal16 h;
749  h._h = 0x7fff;
750  return h;
751 }
752 
753 
756 {
757  fpreal16 h;
758  h._h = 0x7dff;
759  return h;
760 }
761 
762 
763 SYS_FORCE_INLINE unsigned short
765 {
766  return _h;
767 }
768 
769 
770 SYS_FORCE_INLINE void
771 fpreal16::setBits(unsigned short b)
772 {
773  _h = b;
774 }
775 
776 // namespace std overloads
777 namespace std
778 {
779 // gcc defines these as macros in <math.h>
780 #pragma push_macro("isnormal")
781 #pragma push_macro("isfinite")
782 #pragma push_macro("isinf")
783 #pragma push_macro("isnan")
784 #undef isnormal
785 #undef isfinite
786 #undef isinf
787 #undef isnan
788 
789 SYS_DEPRECATED_REPLACE(20.0, "Use SYSisNormal()")
790 static SYS_FORCE_INLINE bool isnormal(fpreal16 v) { return v.isNormalized(); }
791 SYS_DEPRECATED_REPLACE(20.0, "Use SYSisFinite()")
792 static SYS_FORCE_INLINE bool isfinite(fpreal16 v) { return v.isFinite(); }
793 SYS_DEPRECATED_REPLACE(20.0, "Use SYSisInf()")
794 static SYS_FORCE_INLINE bool isinf(fpreal16 v) { return v.isInfinity(); }
795 SYS_DEPRECATED_REPLACE(20.0, "Use SYSisNan()")
796 static SYS_FORCE_INLINE bool isnan(fpreal16 v) { return v.isNan(); }
797 
798 #pragma pop_macro("isnormal")
799 #pragma pop_macro("isfinite")
800 #pragma pop_macro("isinf")
801 #pragma pop_macro("isnan")
802 }
803 
804 #endif
static fpreal16 negInf()
Definition: fpreal16.h:737
OIIO_FORCEINLINE const vint4 & operator/=(vint4 &a, const vint4 &b)
Definition: simd.h:4587
SYS_API void SYSprintBits(std::ostream &os, fpreal16 h)
bool isZero() const
Definition: fpreal16.h:696
const GLdouble * v
Definition: glcorearb.h:837
static const uif * _toFloat
Definition: fpreal16.h:243
IMATH_HOSTDEVICE constexpr Plane3< T > operator-(const Plane3< T > &plane) IMATH_NOEXCEPT
Reflect the pla.
Definition: ImathPlane.h:253
GLdouble s
Definition: glad.h:3009
fpreal16 operator-=(fpreal16 h)
Definition: fpreal16.h:623
fpreal16 operator-() const
Definition: fpreal16.h:590
Tto convert(const Tfrom &source)
fpreal16 operator/=(fpreal16 h)
Definition: fpreal16.h:655
float fpreal32
Definition: SYS_Types.h:200
bool isNegative(const Type &x)
Return true if x is less than zero.
Definition: Math.h:367
uint32 i
Definition: fpreal16.h:230
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
fpreal16 operator*=(fpreal16 h)
Definition: fpreal16.h:639
GLdouble n
Definition: glcorearb.h:2008
GLfloat f
Definition: glcorearb.h:1926
bool isNegative() const
Definition: fpreal16.h:721
static fpreal16 qNan()
Definition: fpreal16.h:746
OIIO_FORCEINLINE const vint4 & operator+=(vint4 &a, const vint4 &b)
Definition: simd.h:4512
#define SYS_DECLARE_IS_FLOATING_POINT(T)
Declare a type as floating point.
fpreal32 f
Definition: fpreal16.h:231
fpreal16 operator+=(fpreal16 h)
Definition: fpreal16.h:607
fpreal16()=default
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
#define SYS_DECLARE_IS_POD(T)
Declare a type as POD.
bool isNan(const float x)
Return true if x is a NaN (Not-A-Number) value.
Definition: Math.h:395
bool isFinite() const
Definition: fpreal16.h:671
static bool _itWorks
Definition: fpreal16.h:245
vfloat4 round(const vfloat4 &a)
Definition: simd.h:7647
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
GLint GLenum GLint x
Definition: glcorearb.h:409
bool isInfinity() const
Definition: fpreal16.h:712
IMATH_HOSTDEVICE const Vec2< S > & operator*=(Vec2< S > &v, const Matrix22< T > &m) IMATH_NOEXCEPT
Vector-matrix multiplication: v *= m.
Definition: ImathMatrix.h:4660
static fpreal16 sNan()
Definition: fpreal16.h:755
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
void setBits(unsigned short bits)
Definition: fpreal16.h:771
short int16
Definition: SYS_Types.h:37
fpreal16 round(unsigned int n) const
Definition: fpreal16.h:531
LeafData & operator=(const LeafData &)=delete
static fpreal16 posInf()
Definition: fpreal16.h:728
bool isNan() const
Definition: fpreal16.h:703
unsigned int uint32
Definition: SYS_Types.h:40
fpreal16 & operator=(const fpreal16 &h)=default
OIIO_FORCEINLINE const vint4 & operator-=(vint4 &a, const vint4 &b)
Definition: simd.h:4539
#define SYS_API
Definition: SYS_API.h:11
unsigned short bits() const
Definition: fpreal16.h:764
static const unsigned short * _eLut
Definition: fpreal16.h:244
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition: Math.h:337
bool isNormalized() const
Definition: fpreal16.h:679
bool isFinite(const float x)
Return true if x is finite.
Definition: Math.h:375
bool isDenormalized() const
Definition: fpreal16.h:687