21 #include <math_constants.h>
25 #define M_PI 3.141593f
33 __both__ operator double ( )
const {
return 0; }
34 __both__ operator float ( )
const {
return 0; }
35 __both__ operator long long( )
const {
return 0; }
36 __both__ operator unsigned long long( )
const {
return 0; }
38 __both__ operator unsigned long ( )
const {
return 0; }
40 __both__ operator unsigned int ( )
const {
return 0; }
41 __both__ operator short ( )
const {
return 0; }
42 __both__ operator unsigned short ( )
const {
return 0; }
44 __both__ operator unsigned char ( )
const {
return 0; }
49 __both__ operator double ( )
const {
return 1; }
50 __both__ operator float ( )
const {
return 1; }
51 __both__ operator long long( )
const {
return 1; }
52 __both__ operator unsigned long long( )
const {
return 1; }
54 __both__ operator unsigned long ( )
const {
return 1; }
56 __both__ operator unsigned int ( )
const {
return 1; }
57 __both__ operator short ( )
const {
return 1; }
58 __both__ operator unsigned short ( )
const {
return 1; }
60 __both__ operator unsigned char ( )
const {
return 1; }
66 __device__
operator double ( )
const {
return -CUDART_INF; }
67 __device__
operator float ( )
const {
return -CUDART_INF_F; }
69 __both__ operator double ( )
const {
return -std::numeric_limits<double>::infinity(); }
70 __both__ operator float ( )
const {
return -std::numeric_limits<float>::infinity(); }
71 __both__ operator long long( )
const {
return std::numeric_limits<long long>::min(); }
72 __both__ operator unsigned long long( )
const {
return std::numeric_limits<unsigned long long>::min(); }
73 __both__ operator long ( )
const {
return std::numeric_limits<long>::min(); }
74 __both__ operator unsigned long ( )
const {
return std::numeric_limits<unsigned long>::min(); }
75 __both__ operator int ( )
const {
return std::numeric_limits<int>::min(); }
76 __both__ operator unsigned int ( )
const {
return std::numeric_limits<unsigned int>::min(); }
77 __both__ operator short ( )
const {
return std::numeric_limits<short>::min(); }
78 __both__ operator unsigned short ( )
const {
return std::numeric_limits<unsigned short>::min(); }
79 __both__ operator char ( )
const {
return std::numeric_limits<char>::min(); }
80 __both__ operator unsigned char ( )
const {
return std::numeric_limits<unsigned char>::min(); }
85 #if defined(__CUDA_ARCH__)
88 return std::numeric_limits<float>::infinity();
95 __device__
operator double ( )
const {
return CUDART_INF; }
96 __device__
operator float ( )
const {
return CUDART_INF_F; }
98 __both__ operator double ( )
const {
return std::numeric_limits<double>::infinity(); }
99 __both__ operator float ( )
const {
return std::numeric_limits<float>::infinity(); }
100 __both__ operator long long( )
const {
return std::numeric_limits<long long>::max(); }
101 __both__ operator unsigned long long( )
const {
return std::numeric_limits<unsigned long long>::max(); }
102 __both__ operator long ( )
const {
return std::numeric_limits<long>::max(); }
103 __both__ operator unsigned long ( )
const {
return std::numeric_limits<unsigned long>::max(); }
104 __both__ operator int ( )
const {
return std::numeric_limits<int>::max(); }
105 __both__ operator unsigned int ( )
const {
return std::numeric_limits<unsigned int>::max(); }
106 __both__ operator short ( )
const {
return std::numeric_limits<short>::max(); }
107 __both__ operator unsigned short ( )
const {
return std::numeric_limits<unsigned short>::max(); }
108 __both__ operator char ( )
const {
return std::numeric_limits<char>::max(); }
109 __both__ operator unsigned char ( )
const {
return std::numeric_limits<unsigned char>::max(); }
116 __device__
operator double( )
const {
return CUDART_NAN; }
117 __device__
operator float ( )
const {
return CUDART_NAN_F; }
119 __both__ operator double( )
const {
return std::numeric_limits<double>::quiet_NaN(); }
120 __both__ operator float ( )
const {
return std::numeric_limits<float>::quiet_NaN(); }
129 __both__ operator double( )
const {
return std::numeric_limits<double>::epsilon(); }
130 __both__ operator float ( )
const {
return std::numeric_limits<float>::epsilon(); }
136 template<
bool is_
integer>