HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ilmbase_halfLimits.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 
36 // Primary authors:
37 // Florian Kainz <kainz@ilm.com>
38 // Rod Bogart <rgb@ilm.com>
39 
40 
41 #ifndef PXR_HALF_LIMITS_H
42 #define PXR_HALF_LIMITS_H
43 
44 
45 //------------------------------------------------------------------------
46 //
47 // C++ standard library-style numeric_limits for class half
48 //
49 //------------------------------------------------------------------------
50 
51 #include <limits>
53 
54 namespace std {
55 
56 template <>
57 class numeric_limits <PXR_NS::pxr_half::half>
58 {
59  private:
60  using half = PXR_NS::pxr_half::half;
61 
62  public:
63 
64  static const bool is_specialized = true;
65 
66  static half min () throw () {return PXR_HALF_NRM_MIN;}
67  static half max () throw () {return PXR_HALF_MAX;}
68 
69  static const int digits = PXR_HALF_MANT_DIG;
70  static const int digits10 = PXR_HALF_DIG;
71  static const bool is_signed = true;
72  static const bool is_integer = false;
73  static const bool is_exact = false;
74  static const int radix = PXR_HALF_RADIX;
75  static half epsilon () throw () {return PXR_HALF_EPSILON;}
76  static half round_error () throw () {return PXR_HALF_EPSILON / 2;}
77 
78  static const int min_exponent = PXR_HALF_MIN_EXP;
79  static const int min_exponent10 = PXR_HALF_MIN_10_EXP;
80  static const int max_exponent = PXR_HALF_MAX_EXP;
81  static const int max_exponent10 = PXR_HALF_MAX_10_EXP;
82 
83  static const bool has_infinity = true;
84  static const bool has_quiet_NaN = true;
85  static const bool has_signaling_NaN = true;
86  static const float_denorm_style has_denorm = denorm_present;
87  static const bool has_denorm_loss = false;
88  static half infinity () throw () {return half::posInf();}
89  static half quiet_NaN () throw () {return half::qNan();}
90  static half signaling_NaN () throw () {return half::sNan();}
91  static half denorm_min () throw () {return PXR_HALF_MIN;}
92 
93  static const bool is_iec559 = false;
94  static const bool is_bounded = false;
95  static const bool is_modulo = false;
96 
97  static const bool traps = true;
98  static const bool tinyness_before = false;
99  static const float_round_style round_style = round_to_nearest;
100 
101 #if __cplusplus >= 201103L
102 
103  // C++11 additions.
104  static constexpr int max_digits10 = PXR_HALF_DECIMAL_DIG;
105  static half lowest () {return -PXR_HALF_MAX;}
106 
107 #endif
108 
109 };
110 
111 
112 } // namespace std
113 
114 #endif
#define PXR_HALF_MIN_10_EXP
Definition: ilmbase_half.h:309
constexpr auto digits10() FMT_NOEXCEPT-> int
Definition: format.h:988
#define PXR_HALF_RADIX
Definition: ilmbase_half.h:297
#define PXR_HALF_DECIMAL_DIG
Definition: ilmbase_half.h:293
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
Definition: half.h:266
bool_constant< is_integral< T >::value &&!std::is_same< T, bool >::value &&!std::is_same< T, char >::value &&!std::is_same< T, wchar_t >::value > is_integer
Definition: format.h:2010
std::integral_constant< bool, std::numeric_limits< T >::is_signed||std::is_same< T, int128_t >::value > is_signed
Definition: format.h:821
#define PXR_NS
Definition: pxr.h:71
#define PXR_HALF_EPSILON
Definition: ilmbase_half.h:279
#define PXR_HALF_MIN_EXP
Definition: ilmbase_half.h:299
#define PXR_HALF_MIN
Definition: ilmbase_half.h:273
#define PXR_HALF_MAX_10_EXP
Definition: ilmbase_half.h:313
#define PXR_HALF_MANT_DIG
Definition: ilmbase_half.h:284
#define PXR_HALF_DIG
Definition: ilmbase_half.h:289
#define PXR_HALF_MAX_EXP
Definition: ilmbase_half.h:304
#define PXR_HALF_NRM_MIN
Definition: ilmbase_half.h:275
#define PXR_HALF_MAX
Definition: ilmbase_half.h:277