2 * Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
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.
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.
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.
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.
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
50 #if !defined(__MATH_FUNCTIONS_DBL_PTX1_H__)
51 #define __MATH_FUNCTIONS_DBL_PTX1_H__
53 #if defined(__CUDABE__)
55 static __forceinline__ double fabs(double a)
57 return (double)fabsf((float)a);
60 static __forceinline__ double fmax(double a, double b)
62 return (double)fmaxf((float)a, (float)b);
65 static __forceinline__ double fmin(double a, double b)
67 return (double)fminf((float)a, (float)b);
70 #if defined(__APPLE__)
72 static __forceinline__ int __isfinited(double a)
74 return __finitef((float)a);
77 static __forceinline__ int __isfinite(/* we do not support long double yet, hence double */double a)
79 return __finitef((float)a);
82 static __forceinline__ int __signbitd(double a)
84 return __signbitf((float)a);
87 static __forceinline__ int __signbitl(/* we do not support long double yet, hence double */double a)
89 return __signbitf((float)a);
92 static __forceinline__ int __isnand(double a)
94 return __isnanf((float)a);
97 static __forceinline__ int __isnan(/* we do not support long double yet, hence double */double a)
99 return __isnanf((float)a);
102 static __forceinline__ int __isinfd(double a)
104 return __isinff((float)a);
107 static __forceinline__ int __isinf(/* we do not support long double yet, hence double */double a)
109 return __isinff((float)a);
112 #else /* __APPLE__ */
114 static __forceinline__ int __finite(double a)
116 return __finitef((float)a);
119 static __forceinline__ int __finitel(/* we do not support long double yet, hence double */double a)
121 return __finitef((float)a);
124 static __forceinline__ int __signbit(double a)
126 return __signbitf((float)a);
129 static __forceinline__ int __signbitl(/* we do not support long double yet, hence double */double a)
131 return __signbitf((float)a);
134 static __forceinline__ int __isinf(double a)
136 return __isinff((float)a);
139 static __forceinline__ int __isinfl(/* we do not support long double yet, hence double */double a)
141 return __isinff((float)a);
144 static __forceinline__ int __isnan(double a)
146 return __isnanf((float)a);
149 static __forceinline__ int __isnanl(/* we do not support long double yet, hence double */double a)
151 return __isnanf((float)a);
154 #endif /* __APPLE__ */
156 static __forceinline__ double sqrt(double a)
158 return (double)sqrtf((float)a);
161 static __forceinline__ double rsqrt(double a)
163 return (double)rsqrtf((float)a);
166 static __forceinline__ double ceil(double a)
168 return (double)ceilf((float)a);
171 static __forceinline__ double trunc(double a)
173 return (double)truncf((float)a);
176 static __forceinline__ double floor(double a)
178 return (double)floorf((float)a);
181 static __forceinline__ double copysign(double a, double b)
183 return (double)copysignf((float)a, (float)b);
186 static __forceinline__ double sin(double a)
188 return (double)sinf((float)a);
191 static __forceinline__ double sinpi(double a)
193 return (double)sinpif((float)a);
196 static __forceinline__ double cos(double a)
198 return (double)cosf((float)a);
201 static __forceinline__ double cospi(double a)
203 return (double)cospif((float)a);
206 static __forceinline__ void sincos(double a, double *sptr, double *cptr)
210 sincosf((float)a, &fs, &fc);
216 static __forceinline__ void sincospi(double a, double *sptr, double *cptr)
220 sincospif((float)a, &fs, &fc);
226 static __forceinline__ double tan(double a)
228 return (double)tanf((float)a);
231 static __forceinline__ double exp(double a)
233 return (double)expf((float)a);
236 static __forceinline__ double exp2(double a)
238 return (double)exp2f((float)a);
241 static __forceinline__ double exp10(double a)
243 return (double)exp10f((float)a);
246 static __forceinline__ double expm1(double a)
248 return (double)expm1f((float)a);
251 static __forceinline__ double cosh(double a)
253 return (double)coshf((float)a);
256 static __forceinline__ double sinh(double a)
258 return (double)sinhf((float)a);
261 static __forceinline__ double tanh(double a)
263 return (double)tanhf((float)a);
266 static __forceinline__ double asin(double a)
268 return (double)asinf((float)a);
271 static __forceinline__ double acos(double a)
273 return (double)acosf((float)a);
276 static __forceinline__ double atan(double a)
278 return (double)atanf((float)a);
281 static __forceinline__ double atan2(double a, double b)
283 return (double)atan2f((float)a, (float)b);
286 static __forceinline__ double log(double a)
288 return (double)logf((float)a);
291 static __forceinline__ double log2(double a)
293 return (double)log2f((float)a);
296 static __forceinline__ double log10(double a)
298 return (double)log10f((float)a);
301 static __forceinline__ double log1p(double a)
303 return (double)log1pf((float)a);
306 static __forceinline__ double acosh(double a)
308 return (double)acoshf((float)a);
311 static __forceinline__ double asinh(double a)
313 return (double)asinhf((float)a);
316 static __forceinline__ double atanh(double a)
318 return (double)atanhf((float)a);
321 static __forceinline__ double hypot(double a, double b)
323 return (double)hypotf((float)a, (float)b);
326 static __forceinline__ double rhypot(double a, double b)
328 return (double)rhypotf((float)a, (float)b);
331 static __forceinline__ double cbrt(double a)
333 return (double)cbrtf((float)a);
336 static __forceinline__ double rcbrt(double a)
338 return (double)rcbrtf((float)a);
341 static __forceinline__ double j0(double a)
343 return (double)j0f((float)a);
346 static __forceinline__ double j1(double a)
348 return (double)j1f((float)a);
351 static __forceinline__ double jn(int n, double a)
353 return (double)jnf(n, (float)a);
356 static __forceinline__ double y0(double a)
358 return (double)y0f((float)a);
361 static __forceinline__ double y1(double a)
363 return (double)y1f((float)a);
366 static __forceinline__ double yn(int n, double a)
368 return (double)ynf(n, (float)a);
371 static __forceinline__ double cyl_bessel_i0(double a)
373 return (double)cyl_bessel_i0f((float)a);
376 static __forceinline__ double erf(double a)
378 return (double)erff((float)a);
381 static __forceinline__ double erfinv(double a)
383 return (double)erfinvf((float)a);
386 static __forceinline__ double erfc(double a)
388 return (double)erfcf((float)a);
391 static __forceinline__ double erfcinv(double a)
393 return (double)erfcinvf((float)a);
396 static __forceinline__ double normcdfinv(double a)
398 return (double)normcdfinvf((float)a);
401 static __forceinline__ double normcdf(double a)
403 return (double)normcdff((float)a);
406 static __forceinline__ double erfcx(double a)
408 return (double)erfcxf((float)a);
411 static __forceinline__ double lgamma(double a)
413 return (double)lgammaf((float)a);
416 static __forceinline__ double tgamma(double a)
418 return (double)tgammaf((float)a);
421 static __forceinline__ double ldexp(double a, int b)
423 return (double)ldexpf((float)a, b);
426 static __forceinline__ double scalbn(double a, int b)
428 return (double)scalbnf((float)a, b);
431 static __forceinline__ double scalbln(double a, long b)
433 return (double)scalblnf((float)a, b);
436 static __forceinline__ double frexp(double a, int *b)
438 return (double)frexpf((float)a, b);
441 static __forceinline__ double modf(double a, double *b)
444 float fa = modff((float)a, &fb);
451 static __forceinline__ double fmod(double a, double b)
453 return (double)fmodf((float)a, (float)b);
456 static __forceinline__ double remainder(double a, double b)
458 return (double)remainderf((float)a, (float)b);
461 static __forceinline__ double remquo(double a, double b, int *c)
463 return (double)remquof((float)a, (float)b, c);
466 static __forceinline__ double nextafter(double a, double b)
468 return (double)nextafterf((float)a, (float)b);
471 static __forceinline__ double nan(const char *tagp)
473 return (double)nanf(tagp);
476 static __forceinline__ double pow(double a, double b)
478 return (double)powf((float)a, (float)b);
481 static __forceinline__ double round(double a)
483 return (double)roundf((float)a);
486 static __forceinline__ long lround(double a)
488 return lroundf((float)a);
491 static __forceinline__ long long llround(double a)
493 return llroundf((float)a);
496 static __forceinline__ double rint(double a)
498 return (double)rintf((float)a);
501 static __forceinline__ long lrint(double a)
503 return lrintf((float)a);
506 static __forceinline__ long long llrint(double a)
508 return llrintf((float)a);
511 static __forceinline__ double nearbyint(double a)
513 return (double)nearbyintf((float)a);
516 static __forceinline__ double fdim(double a, double b)
518 return (double)fdimf((float)a, (float)b);
521 static __forceinline__ int ilogb(double a)
523 return ilogbf((float)a);
526 static __forceinline__ double logb(double a)
528 return (double)logbf((float)a);
531 static __forceinline__ double fma(double a, double b, double c)
533 return (double)fmaf((float)a, (float)b, (float)c);
536 #endif /* __CUDABE__ */
538 #endif /* __MATH_FUNCTIONS_DBL_PTX1_H__ */