Point Cloud Library (PCL)  1.9.1-dev
limits.hpp
1 /*
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2011, Willow Garage, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
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
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of Willow Garage, Inc. nor the names of its
18 * 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
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 * Author: Anatoly Baskeheev, Itseez Ltd, (myname.mysurname@mycompany.com)
35 */
36 
37 #ifndef PCL_DEVICE_NUMERIC_LIMITS_HPP_
38 #define PCL_DEVICE_NUMERIC_LIMITS_HPP_
39 
40 namespace pcl
41 {
42  namespace device
43  {
44  template<class T> struct numeric_limits
45  {
46  typedef T type;
47  __device__ __forceinline__ static type min() { return type(); };
48  __device__ __forceinline__ static type max() { return type(); };
49  __device__ __forceinline__ static type epsilon() { return type(); }
50  __device__ __forceinline__ static type round_error() { return type(); }
51  __device__ __forceinline__ static type denorm_min() { return type(); }
52  __device__ __forceinline__ static type infinity() { return type(); }
53  __device__ __forceinline__ static type quiet_NaN() { return type(); }
54  __device__ __forceinline__ static type signaling_NaN() { return T(); }
55  static const bool is_signed;
56  };
57 
58  template<> struct numeric_limits<bool>
59  {
60  typedef bool type;
61  __device__ __forceinline__ static type min() { return false; };
62  __device__ __forceinline__ static type max() { return true; };
63  __device__ __forceinline__ static type epsilon();
64  __device__ __forceinline__ static type round_error();
65  __device__ __forceinline__ static type denorm_min();
66  __device__ __forceinline__ static type infinity();
67  __device__ __forceinline__ static type quiet_NaN();
68  __device__ __forceinline__ static type signaling_NaN();
69  static const bool is_signed = false;
70  };
71 
72  template<> struct numeric_limits<char>
73  {
74  typedef char type;
75  __device__ __forceinline__ static type min() { return CHAR_MIN; };
76  __device__ __forceinline__ static type max() { return CHAR_MAX; };
77  __device__ __forceinline__ static type epsilon();
78  __device__ __forceinline__ static type round_error();
79  __device__ __forceinline__ static type denorm_min();
80  __device__ __forceinline__ static type infinity();
81  __device__ __forceinline__ static type quiet_NaN();
82  __device__ __forceinline__ static type signaling_NaN();
83  static const bool is_signed = (char)-1 == -1;
84  };
85 
86  template<> struct numeric_limits<signed char>
87  {
88  typedef char type;
89  __device__ __forceinline__ static type min() { return CHAR_MIN; };
90  __device__ __forceinline__ static type max() { return CHAR_MAX; };
91  __device__ __forceinline__ static type epsilon();
92  __device__ __forceinline__ static type round_error();
93  __device__ __forceinline__ static type denorm_min();
94  __device__ __forceinline__ static type infinity();
95  __device__ __forceinline__ static type quiet_NaN();
96  __device__ __forceinline__ static type signaling_NaN();
97  static const bool is_signed = (signed char)-1 == -1;
98  };
99 
100  template<> struct numeric_limits<unsigned char>
101  {
102  typedef unsigned char type;
103  __device__ __forceinline__ static type min() { return 0; };
104  __device__ __forceinline__ static type max() { return UCHAR_MAX; };
105  __device__ __forceinline__ static type epsilon();
106  __device__ __forceinline__ static type round_error();
107  __device__ __forceinline__ static type denorm_min();
108  __device__ __forceinline__ static type infinity();
109  __device__ __forceinline__ static type quiet_NaN();
110  __device__ __forceinline__ static type signaling_NaN();
111  static const bool is_signed = false;
112  };
113 
114  template<> struct numeric_limits<short>
115  {
116  typedef short type;
117  __device__ __forceinline__ static type min() { return SHRT_MIN; };
118  __device__ __forceinline__ static type max() { return SHRT_MAX; };
119  __device__ __forceinline__ static type epsilon();
120  __device__ __forceinline__ static type round_error();
121  __device__ __forceinline__ static type denorm_min();
122  __device__ __forceinline__ static type infinity();
123  __device__ __forceinline__ static type quiet_NaN();
124  __device__ __forceinline__ static type signaling_NaN();
125  static const bool is_signed = true;
126  };
127 
128  template<> struct numeric_limits<unsigned short>
129  {
130  typedef unsigned short type;
131  __device__ __forceinline__ static type min() { return 0; };
132  __device__ __forceinline__ static type max() { return USHRT_MAX; };
133  __device__ __forceinline__ static type epsilon();
134  __device__ __forceinline__ static type round_error();
135  __device__ __forceinline__ static type denorm_min();
136  __device__ __forceinline__ static type infinity();
137  __device__ __forceinline__ static type quiet_NaN();
138  __device__ __forceinline__ static type signaling_NaN();
139  static const bool is_signed = false;
140  };
141 
142  template<> struct numeric_limits<int>
143  {
144  typedef int type;
145  __device__ __forceinline__ static type min() { return INT_MIN; };
146  __device__ __forceinline__ static type max() { return INT_MAX; };
147  __device__ __forceinline__ static type epsilon();
148  __device__ __forceinline__ static type round_error();
149  __device__ __forceinline__ static type denorm_min();
150  __device__ __forceinline__ static type infinity();
151  __device__ __forceinline__ static type quiet_NaN();
152  __device__ __forceinline__ static type signaling_NaN();
153  static const bool is_signed = true;
154  };
155 
156 
157  template<> struct numeric_limits<unsigned int>
158  {
159  typedef unsigned int type;
160  __device__ __forceinline__ static type min() { return 0; };
161  __device__ __forceinline__ static type max() { return UINT_MAX; };
162  __device__ __forceinline__ static type epsilon();
163  __device__ __forceinline__ static type round_error();
164  __device__ __forceinline__ static type denorm_min();
165  __device__ __forceinline__ static type infinity();
166  __device__ __forceinline__ static type quiet_NaN();
167  __device__ __forceinline__ static type signaling_NaN();
168  static const bool is_signed = false;
169  };
170 
171  template<> struct numeric_limits<long>
172  {
173  typedef long type;
174  __device__ __forceinline__ static type min() { return LONG_MIN; };
175  __device__ __forceinline__ static type max() { return LONG_MAX; };
176  __device__ __forceinline__ static type epsilon();
177  __device__ __forceinline__ static type round_error();
178  __device__ __forceinline__ static type denorm_min();
179  __device__ __forceinline__ static type infinity();
180  __device__ __forceinline__ static type quiet_NaN();
181  __device__ __forceinline__ static type signaling_NaN();
182  static const bool is_signed = true;
183  };
184 
185  template<> struct numeric_limits<unsigned long>
186  {
187  typedef unsigned long type;
188  __device__ __forceinline__ static type min() { return 0; };
189  __device__ __forceinline__ static type max() { return ULONG_MAX; };
190  __device__ __forceinline__ static type epsilon();
191  __device__ __forceinline__ static type round_error();
192  __device__ __forceinline__ static type denorm_min();
193  __device__ __forceinline__ static type infinity();
194  __device__ __forceinline__ static type quiet_NaN();
195  __device__ __forceinline__ static type signaling_NaN();
196  static const bool is_signed = false;
197  };
198 
199  template<> struct numeric_limits<float>
200  {
201  typedef float type;
202  __device__ __forceinline__ static type min() { return 1.175494351e-38f/*FLT_MIN*/; };
203  __device__ __forceinline__ static type max() { return 3.402823466e+38f/*FLT_MAX*/; };
204  __device__ __forceinline__ static type epsilon() { return 1.192092896e-07f/*FLT_EPSILON*/; };
205  __device__ __forceinline__ static type round_error();
206  __device__ __forceinline__ static type denorm_min();
207  __device__ __forceinline__ static type infinity() { return __int_as_float(0x7f800000); /*CUDART_INF_F*/ };
208  __device__ __forceinline__ static type quiet_NaN() { return __int_as_float(0x7fffffff); /*CUDART_NAN_F*/ };
209  __device__ __forceinline__ static type signaling_NaN();
210  static const bool is_signed = true;
211  };
212 
213  template<> struct numeric_limits<double>
214  {
215  typedef double type;
216  __device__ __forceinline__ static type min() { return 2.2250738585072014e-308/*DBL_MIN*/; };
217  __device__ __forceinline__ static type max() { return 1.7976931348623158e+308/*DBL_MAX*/; };
218  __device__ __forceinline__ static type epsilon() { return 2.2204460492503131e-016 /*DBL_EPSILON*/; };
219  __device__ __forceinline__ static type round_error();
220  __device__ __forceinline__ static type denorm_min();
221  __device__ __forceinline__ static type infinity();
222  __device__ __forceinline__ static type quiet_NaN();
223  __device__ __forceinline__ static type signaling_NaN();
224  static const bool is_signed = true;
225  };
226  }
227 }
228 #endif /* PCL_DEVICE_NUMERIC_LIMITS_HPP_ */
__device__ static __forceinline__ type epsilon()
Definition: limits.hpp:204
__device__ static __forceinline__ type min()
Definition: limits.hpp:131
__device__ static __forceinline__ type round_error()
Definition: limits.hpp:50
static const bool is_signed
Definition: limits.hpp:55
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:44
__device__ static __forceinline__ type min()
Definition: limits.hpp:75
__device__ static __forceinline__ type max()
Definition: limits.hpp:146
__device__ static __forceinline__ type max()
Definition: limits.hpp:203
__device__ static __forceinline__ type max()
Definition: limits.hpp:90
__device__ static __forceinline__ type min()
Definition: limits.hpp:145
__device__ static __forceinline__ type min()
Definition: limits.hpp:89
__device__ static __forceinline__ type max()
Definition: limits.hpp:175
__device__ static __forceinline__ type max()
Definition: limits.hpp:217
__device__ static __forceinline__ type min()
Definition: limits.hpp:188
__device__ static __forceinline__ type max()
Definition: limits.hpp:118
__device__ static __forceinline__ type max()
Definition: limits.hpp:132
__device__ static __forceinline__ type epsilon()
Definition: limits.hpp:218
__device__ static __forceinline__ type max()
Definition: limits.hpp:76
__device__ static __forceinline__ type min()
Definition: limits.hpp:216
__device__ static __forceinline__ type min()
Definition: limits.hpp:61
__device__ static __forceinline__ type max()
Definition: limits.hpp:104
__device__ static __forceinline__ type epsilon()
Definition: limits.hpp:49
__device__ static __forceinline__ type infinity()
Definition: limits.hpp:52
__device__ static __forceinline__ type signaling_NaN()
Definition: limits.hpp:54
__device__ static __forceinline__ type quiet_NaN()
Definition: limits.hpp:208
__device__ static __forceinline__ type max()
Definition: limits.hpp:189
__device__ static __forceinline__ type infinity()
Definition: limits.hpp:207
__device__ static __forceinline__ type min()
Definition: limits.hpp:160
__device__ static __forceinline__ type quiet_NaN()
Definition: limits.hpp:53
__device__ static __forceinline__ type min()
Definition: limits.hpp:174
__device__ static __forceinline__ type min()
Definition: limits.hpp:47
__device__ static __forceinline__ type min()
Definition: limits.hpp:103
__device__ static __forceinline__ type min()
Definition: limits.hpp:202
__device__ static __forceinline__ type max()
Definition: limits.hpp:62
__device__ static __forceinline__ type max()
Definition: limits.hpp:161
__device__ static __forceinline__ type min()
Definition: limits.hpp:117
__device__ static __forceinline__ type denorm_min()
Definition: limits.hpp:51
__device__ static __forceinline__ type max()
Definition: limits.hpp:48