OSDN Git Service

CUDA
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / cuda-6.5 / include / math_functions_dbl_ptx1.h
1 /*
2  * Copyright 1993-2012 NVIDIA Corporation.  All rights reserved.
3  *
4  * NOTICE TO LICENSEE:
5  *
6  * This source code and/or documentation ("Licensed Deliverables") are
7  * subject to NVIDIA intellectual property rights under U.S. and
8  * international Copyright laws.
9  *
10  * These Licensed Deliverables contained herein is PROPRIETARY and
11  * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12  * conditions of a form of NVIDIA software license agreement by and
13  * between NVIDIA and Licensee ("License Agreement") or electronically
14  * accepted by Licensee.  Notwithstanding any terms or conditions to
15  * the contrary in the License Agreement, reproduction or disclosure
16  * of the Licensed Deliverables to any third party without the express
17  * written consent of NVIDIA is prohibited.
18  *
19  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20  * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21  * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE.  IT IS
22  * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23  * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24  * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25  * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27  * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28  * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32  * OF THESE LICENSED DELIVERABLES.
33  *
34  * U.S. Government End Users.  These Licensed Deliverables are a
35  * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36  * 1995), consisting of "commercial computer software" and "commercial
37  * computer software documentation" as such terms are used in 48
38  * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39  * only as a commercial end item.  Consistent with 48 C.F.R.12.212 and
40  * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41  * U.S. Government End Users acquire the Licensed Deliverables with
42  * only those rights set forth herein.
43  *
44  * Any use of the Licensed Deliverables in individual and commercial
45  * software must include, in the user documentation and internal
46  * comments to the code, the above Disclaimer and U.S. Government End
47  * Users Notice.
48  */
49
50 #if !defined(__MATH_FUNCTIONS_DBL_PTX1_H__)
51 #define __MATH_FUNCTIONS_DBL_PTX1_H__
52
53 #if defined(__CUDABE__)
54
55 static __forceinline__ double fabs(double a)
56 {
57   return (double)fabsf((float)a);
58 }
59
60 static __forceinline__ double fmax(double a, double b)
61 {
62   return (double)fmaxf((float)a, (float)b);
63 }
64
65 static __forceinline__ double fmin(double a, double b)
66 {
67   return (double)fminf((float)a, (float)b);
68 }
69
70 #if defined(__APPLE__)
71
72 static __forceinline__ int __isfinited(double a)
73 {
74   return __finitef((float)a);
75 }
76
77 static __forceinline__ int __isfinite(/* we do not support long double yet, hence double */double a)
78 {
79   return __finitef((float)a);
80 }
81
82 static __forceinline__ int __signbitd(double a)
83 {
84   return __signbitf((float)a);
85 }
86
87 static __forceinline__ int __signbitl(/* we do not support long double yet, hence double */double a)
88 {
89   return __signbitf((float)a);
90 }
91
92 static __forceinline__ int __isnand(double a)
93 {
94   return __isnanf((float)a);
95 }
96
97 static __forceinline__ int __isnan(/* we do not support long double yet, hence double */double a)
98 {
99   return __isnanf((float)a);
100 }
101
102 static __forceinline__ int __isinfd(double a)
103 {
104   return __isinff((float)a);
105 }
106
107 static __forceinline__ int __isinf(/* we do not support long double yet, hence double */double a)
108 {
109   return __isinff((float)a);
110 }
111
112 #else /* __APPLE__ */
113
114 static __forceinline__ int __finite(double a)
115 {
116   return __finitef((float)a);
117 }
118
119 static __forceinline__ int __finitel(/* we do not support long double yet, hence double */double a)
120 {
121   return __finitef((float)a);
122 }
123
124 static __forceinline__ int __signbit(double a)
125 {
126   return __signbitf((float)a);
127 }
128
129 static __forceinline__ int __signbitl(/* we do not support long double yet, hence double */double a)
130 {
131   return __signbitf((float)a);
132 }
133
134 static __forceinline__ int __isinf(double a)
135 {
136   return __isinff((float)a);
137 }
138
139 static __forceinline__ int __isinfl(/* we do not support long double yet, hence double */double a)
140 {
141   return __isinff((float)a);
142 }
143
144 static __forceinline__ int __isnan(double a)
145 {
146   return __isnanf((float)a);
147 }
148
149 static __forceinline__ int __isnanl(/* we do not support long double yet, hence double */double a)
150 {
151   return __isnanf((float)a);
152 }
153
154 #endif /* __APPLE__ */
155
156 static __forceinline__ double sqrt(double a)
157 {
158   return (double)sqrtf((float)a);
159 }
160
161 static __forceinline__ double rsqrt(double a)
162 {
163   return (double)rsqrtf((float)a);
164 }
165
166 static __forceinline__ double ceil(double a)
167 {
168   return (double)ceilf((float)a);
169 }
170
171 static __forceinline__ double trunc(double a)
172 {
173   return (double)truncf((float)a);
174 }
175
176 static __forceinline__ double floor(double a)
177 {
178   return (double)floorf((float)a);
179 }
180
181 static __forceinline__ double copysign(double a, double b)
182 {
183   return (double)copysignf((float)a, (float)b);
184 }
185
186 static __forceinline__ double sin(double a)
187 {
188   return (double)sinf((float)a);
189 }
190
191 static __forceinline__ double sinpi(double a)
192 {
193   return (double)sinpif((float)a);
194 }
195
196 static __forceinline__ double cos(double a)
197 {
198   return (double)cosf((float)a);
199 }
200
201 static __forceinline__ double cospi(double a)
202 {
203   return (double)cospif((float)a);
204 }
205
206 static __forceinline__ void sincos(double a, double *sptr, double *cptr)
207 {
208   float fs, fc;
209
210   sincosf((float)a, &fs, &fc);
211
212   *sptr = (double)fs;
213   *cptr = (double)fc;
214 }
215
216 static __forceinline__ void sincospi(double a, double *sptr, double *cptr)
217 {
218   float fs, fc;
219
220   sincospif((float)a, &fs, &fc);
221
222   *sptr = (double)fs;
223   *cptr = (double)fc;
224 }
225
226 static __forceinline__ double tan(double a)
227 {
228   return (double)tanf((float)a);
229 }
230
231 static __forceinline__ double exp(double a)
232 {
233   return (double)expf((float)a);
234 }
235
236 static __forceinline__ double exp2(double a)
237 {
238   return (double)exp2f((float)a);
239 }
240
241 static __forceinline__ double exp10(double a)
242 {
243   return (double)exp10f((float)a);
244 }
245
246 static __forceinline__ double expm1(double a)
247 {
248   return (double)expm1f((float)a);
249 }
250
251 static __forceinline__ double cosh(double a)
252 {
253   return (double)coshf((float)a);
254 }
255
256 static __forceinline__ double sinh(double a)
257 {
258   return (double)sinhf((float)a);
259 }
260
261 static __forceinline__ double tanh(double a)
262 {
263   return (double)tanhf((float)a);
264 }
265
266 static __forceinline__ double asin(double a)
267 {
268   return (double)asinf((float)a);
269 }
270
271 static __forceinline__ double acos(double a)
272 {
273   return (double)acosf((float)a);
274 }
275
276 static __forceinline__ double atan(double a)
277 {
278   return (double)atanf((float)a);
279 }
280
281 static __forceinline__ double atan2(double a, double b)
282 {
283   return (double)atan2f((float)a, (float)b);
284 }
285
286 static __forceinline__ double log(double a)
287 {
288   return (double)logf((float)a);
289 }
290
291 static __forceinline__ double log2(double a)
292 {
293   return (double)log2f((float)a);
294 }
295
296 static __forceinline__ double log10(double a)
297 {
298   return (double)log10f((float)a);
299 }
300
301 static __forceinline__ double log1p(double a)
302 {
303   return (double)log1pf((float)a);
304 }
305
306 static __forceinline__ double acosh(double a)
307 {
308   return (double)acoshf((float)a);
309 }
310
311 static __forceinline__ double asinh(double a)
312 {
313   return (double)asinhf((float)a);
314 }
315
316 static __forceinline__ double atanh(double a)
317 {
318   return (double)atanhf((float)a);
319 }
320
321 static __forceinline__ double hypot(double a, double b)
322 {
323   return (double)hypotf((float)a, (float)b);
324 }
325
326 static __forceinline__ double rhypot(double a, double b)
327 {
328   return (double)rhypotf((float)a, (float)b);
329 }
330
331 static __forceinline__ double cbrt(double a)
332 {
333   return (double)cbrtf((float)a);
334 }
335
336 static __forceinline__ double rcbrt(double a)
337 {
338   return (double)rcbrtf((float)a);
339 }
340
341 static __forceinline__ double j0(double a)
342 {
343   return (double)j0f((float)a);
344 }
345
346 static __forceinline__ double j1(double a)
347 {
348   return (double)j1f((float)a);
349 }
350
351 static __forceinline__ double jn(int n, double a)
352 {
353   return (double)jnf(n, (float)a);
354 }
355
356 static __forceinline__ double y0(double a)
357 {
358   return (double)y0f((float)a);
359 }
360
361 static __forceinline__ double y1(double a)
362 {
363   return (double)y1f((float)a);
364 }
365
366 static __forceinline__ double yn(int n, double a)
367 {
368   return (double)ynf(n, (float)a);
369 }
370
371 static __forceinline__ double cyl_bessel_i0(double a)
372 {
373   return (double)cyl_bessel_i0f((float)a);
374 }
375
376 static __forceinline__ double erf(double a)
377 {
378   return (double)erff((float)a);
379 }
380
381 static __forceinline__ double erfinv(double a)
382 {
383   return (double)erfinvf((float)a);
384 }
385
386 static __forceinline__ double erfc(double a)
387 {
388   return (double)erfcf((float)a);
389 }
390
391 static __forceinline__ double erfcinv(double a)
392 {
393   return (double)erfcinvf((float)a);
394 }
395
396 static __forceinline__ double normcdfinv(double a)
397 {
398   return (double)normcdfinvf((float)a);
399 }
400
401 static __forceinline__ double normcdf(double a)
402 {
403   return (double)normcdff((float)a);
404 }
405
406 static __forceinline__ double erfcx(double a)
407 {
408   return (double)erfcxf((float)a);
409 }
410
411 static __forceinline__ double lgamma(double a)
412 {
413   return (double)lgammaf((float)a);
414 }
415
416 static __forceinline__ double tgamma(double a)
417 {
418   return (double)tgammaf((float)a);
419 }
420
421 static __forceinline__ double ldexp(double a, int b)
422 {
423   return (double)ldexpf((float)a, b);
424 }
425
426 static __forceinline__ double scalbn(double a, int b)
427 {
428   return (double)scalbnf((float)a, b);
429 }
430
431 static __forceinline__ double scalbln(double a, long b)
432 {
433   return (double)scalblnf((float)a, b);
434 }
435
436 static __forceinline__ double frexp(double a, int *b)
437 {
438   return (double)frexpf((float)a, b);
439 }
440
441 static __forceinline__ double modf(double a, double *b)
442 {
443   float fb;
444   float fa = modff((float)a, &fb);
445
446   *b = (double)fb;
447
448   return (double)fa;  
449 }
450
451 static __forceinline__ double fmod(double a, double b)
452 {
453   return (double)fmodf((float)a, (float)b);
454 }
455
456 static __forceinline__ double remainder(double a, double b)
457 {
458   return (double)remainderf((float)a, (float)b);
459 }
460
461 static __forceinline__ double remquo(double a, double b, int *c)
462 {
463   return (double)remquof((float)a, (float)b, c);
464 }
465
466 static __forceinline__ double nextafter(double a, double b)
467 {
468   return (double)nextafterf((float)a, (float)b);
469 }
470
471 static __forceinline__ double nan(const char *tagp)
472 {
473   return (double)nanf(tagp);
474 }
475
476 static __forceinline__ double pow(double a, double b)
477 {
478   return (double)powf((float)a, (float)b);
479 }
480
481 static __forceinline__ double round(double a)
482 {
483   return (double)roundf((float)a);
484 }
485
486 static __forceinline__ long lround(double a)
487 {
488   return lroundf((float)a);
489 }
490
491 static __forceinline__ long long llround(double a)
492 {
493   return llroundf((float)a);
494 }
495
496 static __forceinline__ double rint(double a)
497 {
498   return (double)rintf((float)a);
499 }
500
501 static __forceinline__ long lrint(double a)
502 {
503   return lrintf((float)a);
504 }
505
506 static __forceinline__ long long llrint(double a)
507 {
508   return llrintf((float)a);
509 }
510
511 static __forceinline__ double nearbyint(double a)
512 {
513   return (double)nearbyintf((float)a);
514 }
515
516 static __forceinline__ double fdim(double a, double b)
517 {
518   return (double)fdimf((float)a, (float)b);
519 }
520
521 static __forceinline__ int ilogb(double a)
522 {
523   return ilogbf((float)a);
524 }
525
526 static __forceinline__ double logb(double a)
527 {
528   return (double)logbf((float)a);
529 }
530
531 static __forceinline__ double fma(double a, double b, double c)
532 {
533   return (double)fmaf((float)a, (float)b, (float)c);
534 }
535
536 #endif /* __CUDABE__ */
537
538 #endif /* __MATH_FUNCTIONS_DBL_PTX1_H__ */