22#include <math_constants.h>
34 __both__
operator double ( )
const {
return 0; }
35 __both__
operator float ( )
const {
return 0; }
36 __both__
operator long long( )
const {
return 0; }
37 __both__
operator unsigned long long( )
const {
return 0; }
38 __both__
operator long ( )
const {
return 0; }
39 __both__
operator unsigned long ( )
const {
return 0; }
40 __both__
operator int ( )
const {
return 0; }
41 __both__
operator unsigned int ( )
const {
return 0; }
42 __both__
operator short ( )
const {
return 0; }
43 __both__
operator unsigned short ( )
const {
return 0; }
44 __both__
operator char ( )
const {
return 0; }
45 __both__
operator unsigned char ( )
const {
return 0; }
50 __both__
operator double ( )
const {
return 1; }
51 __both__
operator float ( )
const {
return 1; }
52 __both__
operator long long( )
const {
return 1; }
53 __both__
operator unsigned long long( )
const {
return 1; }
54 __both__
operator long ( )
const {
return 1; }
55 __both__
operator unsigned long ( )
const {
return 1; }
56 __both__
operator int ( )
const {
return 1; }
57 __both__
operator unsigned int ( )
const {
return 1; }
58 __both__
operator short ( )
const {
return 1; }
59 __both__
operator unsigned short ( )
const {
return 1; }
60 __both__
operator char ( )
const {
return 1; }
61 __both__
operator unsigned char ( )
const {
return 1; }
64 static struct NegInfTy
67 __device__
operator double ( )
const {
return -CUDART_INF; }
68 __device__
operator float ( )
const {
return -CUDART_INF_F; }
70 __both__
operator double ( )
const {
return -std::numeric_limits<double>::infinity(); }
71 __both__
operator float ( )
const {
return -std::numeric_limits<float>::infinity(); }
72 __both__
operator long long( )
const {
return std::numeric_limits<long long>::min(); }
73 __both__
operator unsigned long long( )
const {
return std::numeric_limits<unsigned long long>::min(); }
74 __both__
operator long ( )
const {
return std::numeric_limits<long>::min(); }
75 __both__
operator unsigned long ( )
const {
return std::numeric_limits<unsigned long>::min(); }
76 __both__
operator int ( )
const {
return std::numeric_limits<int>::min(); }
77 __both__
operator unsigned int ( )
const {
return std::numeric_limits<unsigned int>::min(); }
78 __both__
operator short ( )
const {
return std::numeric_limits<short>::min(); }
79 __both__
operator unsigned short ( )
const {
return std::numeric_limits<unsigned short>::min(); }
80 __both__
operator char ( )
const {
return std::numeric_limits<char>::min(); }
81 __both__
operator unsigned char ( )
const {
return std::numeric_limits<unsigned char>::min(); }
83 } neg_inf MAYBE_UNUSED;
85 inline __both__
float infty() {
86#if defined(__CUDA_ARCH__)
89 return std::numeric_limits<float>::infinity();
93 static struct PosInfTy
96 __device__
operator double ( )
const {
return CUDART_INF; }
97 __device__
operator float ( )
const {
return CUDART_INF_F; }
99 __both__
operator double ( )
const {
return std::numeric_limits<double>::infinity(); }
100 __both__
operator float ( )
const {
return std::numeric_limits<float>::infinity(); }
101 __both__
operator long long( )
const {
return std::numeric_limits<long long>::max(); }
102 __both__
operator unsigned long long( )
const {
return std::numeric_limits<unsigned long long>::max(); }
103 __both__
operator long ( )
const {
return std::numeric_limits<long>::max(); }
104 __both__
operator unsigned long ( )
const {
return std::numeric_limits<unsigned long>::max(); }
105 __both__
operator int ( )
const {
return std::numeric_limits<int>::max(); }
106 __both__
operator unsigned int ( )
const {
return std::numeric_limits<unsigned int>::max(); }
107 __both__
operator short ( )
const {
return std::numeric_limits<short>::max(); }
108 __both__
operator unsigned short ( )
const {
return std::numeric_limits<unsigned short>::max(); }
109 __both__
operator char ( )
const {
return std::numeric_limits<char>::max(); }
110 __both__
operator unsigned char ( )
const {
return std::numeric_limits<unsigned char>::max(); }
112 } inf MAYBE_UNUSED, pos_inf MAYBE_UNUSED;
117 __device__
operator double( )
const {
return CUDART_NAN; }
118 __device__
operator float ( )
const {
return CUDART_NAN_F; }
120 __both__
operator double( )
const {
return std::numeric_limits<double>::quiet_NaN(); }
121 __both__
operator float ( )
const {
return std::numeric_limits<float>::quiet_NaN(); }
130 __both__
operator double( )
const {
return std::numeric_limits<double>::epsilon(); }
131 __both__
operator float ( )
const {
return std::numeric_limits<float>::epsilon(); }
137 template<
bool is_
integer>
141 template<
typename T>
static inline __both__ T value_limits_lower(T) {
return std::numeric_limits<T>::min(); }
142 template<
typename T>
static inline __both__ T value_limits_upper(T) {
return std::numeric_limits<T>::max(); }
145 template<
typename T>
static inline __both__ T value_limits_lower(T) {
return (T)NegInfTy(); }
146 template<
typename T>
static inline __both__ T value_limits_upper(T) {
return (T)PosInfTy(); }
150 template<
typename T>
inline __both__ T empty_bounds_lower()
156 template<
typename T>
inline __both__ T empty_bounds_upper()
162 template<
typename T>
inline __both__ T empty_range_lower()
164 return limits_traits<std::numeric_limits<T>::is_integer>::value_limits_upper(T());
168 template<
typename T>
inline __both__ T empty_range_upper()
170 return limits_traits<std::numeric_limits<T>::is_integer>::value_limits_lower(T());
174 template<
typename T>
inline __both__ T open_range_lower()
176 return limits_traits<std::numeric_limits<T>::is_integer>::value_limits_lower(T());
180 template<
typename T>
inline __both__ T open_range_upper()
182 return limits_traits<std::numeric_limits<T>::is_integer>::value_limits_upper(T());
185 template<>
inline __both__ uint32_t empty_bounds_lower<uint32_t>()
186 {
return uint32_t(UINT_MAX); }
187 template<>
inline __both__ uint32_t empty_bounds_upper<uint32_t>()
188 {
return uint32_t(0); }
189 template<>
inline __both__ uint32_t open_range_lower<uint32_t>()
190 {
return uint32_t(0); }
191 template<>
inline __both__ uint32_t open_range_upper<uint32_t>()
192 {
return uint32_t(UINT_MAX); }
194 template<>
inline __both__ int32_t empty_bounds_lower<int32_t>()
195 {
return int32_t(INT_MAX); }
196 template<>
inline __both__ int32_t empty_bounds_upper<int32_t>()
197 {
return int32_t(INT_MIN); }
198 template<>
inline __both__ int32_t open_range_lower<int32_t>()
199 {
return int32_t(INT_MIN); }
200 template<>
inline __both__ int32_t open_range_upper<int32_t>()
201 {
return int32_t(INT_MAX); }
203 template<>
inline __both__ uint64_t empty_bounds_lower<uint64_t>()
204 {
return uint64_t(ULONG_MAX); }
205 template<>
inline __both__ uint64_t empty_bounds_upper<uint64_t>()
206 {
return uint64_t(0); }
207 template<>
inline __both__ uint64_t open_range_lower<uint64_t>()
208 {
return uint64_t(0); }
209 template<>
inline __both__ uint64_t open_range_upper<uint64_t>()
210 {
return uint64_t(ULONG_MAX); }
212 template<>
inline __both__ int64_t empty_bounds_lower<int64_t>()
213 {
return int64_t(LONG_MAX); }
214 template<>
inline __both__ int64_t empty_bounds_upper<int64_t>()
215 {
return int64_t(LONG_MIN); }
216 template<>
inline __both__ int64_t open_range_lower<int64_t>()
217 {
return int64_t(LONG_MIN); }
218 template<>
inline __both__ int64_t open_range_upper<int64_t>()
219 {
return int64_t(LONG_MAX); }
222 template<>
inline __both__ uint16_t empty_bounds_lower<uint16_t>()
223 {
return uint16_t(USHRT_MAX); }
224 template<>
inline __both__ uint16_t empty_bounds_upper<uint16_t>()
225 {
return uint16_t(0); }
226 template<>
inline __both__ uint16_t open_range_lower<uint16_t>()
227 {
return uint16_t(0); }
228 template<>
inline __both__ uint16_t open_range_upper<uint16_t>()
229 {
return uint16_t(USHRT_MAX); }
231 template<>
inline __both__ int16_t empty_bounds_lower<int16_t>()
232 {
return int16_t(SHRT_MAX); }
233 template<>
inline __both__ int16_t empty_bounds_upper<int16_t>()
234 {
return int16_t(SHRT_MIN); }
235 template<>
inline __both__ int16_t open_range_lower<int16_t>()
236 {
return int16_t(SHRT_MIN); }
237 template<>
inline __both__ int16_t open_range_upper<int16_t>()
238 {
return int16_t(SHRT_MAX); }
240 template<>
inline __both__ uint8_t empty_bounds_lower<uint8_t>()
241 {
return uint8_t(CHAR_MAX); }
242 template<>
inline __both__ uint8_t empty_bounds_upper<uint8_t>()
243 {
return uint8_t(CHAR_MIN); }
244 template<>
inline __both__ uint8_t open_range_lower<uint8_t>()
245 {
return uint8_t(CHAR_MIN); }
246 template<>
inline __both__ uint8_t open_range_upper<uint8_t>()
247 {
return uint8_t(CHAR_MAX); }
249 template<>
inline __both__ int8_t empty_bounds_lower<int8_t>()
250 {
return int8_t(SCHAR_MIN); }
251 template<>
inline __both__ int8_t empty_bounds_upper<int8_t>()
252 {
return int8_t(SCHAR_MAX); }
253 template<>
inline __both__ int8_t open_range_lower<int8_t>()
254 {
return int8_t(SCHAR_MAX); }
255 template<>
inline __both__ int8_t open_range_upper<int8_t>()
256 {
return int8_t(SCHAR_MIN); }
Definition: constants.h:138