9#ifndef __CLANG_CUDA_CMATH_H__
10#define __CLANG_CUDA_CMATH_H__
12#error "This file is for CUDA compilation only."
15#ifndef __OPENMP_NVPTX__
35#ifdef __OPENMP_NVPTX__
36#define __DEVICE__ static constexpr __attribute__((always_inline, nothrow))
38#define __DEVICE__ static __device__ __inline__ __attribute__((always_inline))
57 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
61 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
65 return ::frexpf(__arg, __exp);
72#if !defined(_MSC_VER) && !defined(__OPENMP_NVPTX__)
85 return __builtin_isgreater(
__x,
__y);
88 return __builtin_isgreater(
__x,
__y);
91 return __builtin_isgreaterequal(
__x,
__y);
94 return __builtin_isgreaterequal(
__x,
__y);
97 return __builtin_isless(
__x,
__y);
100 return __builtin_isless(
__x,
__y);
103 return __builtin_islessequal(
__x,
__y);
106 return __builtin_islessequal(
__x,
__y);
109 return __builtin_islessgreater(
__x,
__y);
112 return __builtin_islessgreater(
__x,
__y);
117 return __builtin_isunordered(
__x,
__y);
120 return __builtin_isunordered(
__x,
__y);
123 return ::ldexpf(__arg, __exp);
129 return ::powf(__base, __exp);
132 return ::powif(__base, __iexp);
135 return ::powi(__base, __iexp);
149#ifndef __OPENMP_NVPTX__
166template<
bool __B,
class __T =
void>
175#define __CUDA_CLANG_FN_INTEGER_OVERLOAD_1(__retty, __fn) \
176 template <typename __T> \
178 typename __clang_cuda_enable_if<std::numeric_limits<__T>::is_integer, \
181 return ::__fn((double)__x); \
189#define __CUDA_CLANG_FN_INTEGER_OVERLOAD_2(__retty, __fn) \
190 template <typename __T1, typename __T2> \
191 __DEVICE__ typename __clang_cuda_enable_if< \
192 std::numeric_limits<__T1>::is_specialized && \
193 std::numeric_limits<__T2>::is_specialized, \
195 __fn(__T1 __x, __T2 __y) { \
196 return __fn((double)__x, (double)__y); \
260#undef __CUDA_CLANG_FN_INTEGER_OVERLOAD_1
261#undef __CUDA_CLANG_FN_INTEGER_OVERLOAD_2
265template <
typename __T1,
typename __T2,
typename __T3>
267 std::numeric_limits<__T1>::is_specialized &&
268 std::numeric_limits<__T2>::is_specialized &&
269 std::numeric_limits<__T3>::is_specialized,
272 return std::fma((
double)
__x, (
double)
__y, (
double)__z);
275template <
typename __T>
279 return std::frexp((
double)
__x, __exp);
282template <
typename __T>
286 return std::ldexp((
double)
__x, __exp);
289template <
typename __T1,
typename __T2>
291 std::numeric_limits<__T1>::is_specialized &&
292 std::numeric_limits<__T2>::is_specialized,
295 return std::remquo((
double)
__x, (
double)
__y, __quo);
298template <
typename __T>
302 return std::scalbln((
double)
__x, __exp);
305template <
typename __T>
309 return std::scalbn((
double)
__x, __exp);
316#ifdef _LIBCPP_BEGIN_NAMESPACE_STD
317_LIBCPP_BEGIN_NAMESPACE_STD
320#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION
321_GLIBCXX_BEGIN_NAMESPACE_VERSION
356using ::isgreaterequal;
359using ::islessgreater;
457#ifdef _LIBCPP_END_NAMESPACE_STD
458_LIBCPP_END_NAMESPACE_STD
460#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION
461_GLIBCXX_END_NAMESPACE_VERSION
__DEVICE__ bool isunordered(float __x, float __y)
Test if arguments are unordered.
__DEVICE__ bool isgreater(float __x, float __y)
Returns the component-wise compare of x > y.
__DEVICE__ bool islessgreater(float __x, float __y)
Returns the component-wise compare of (x < y) || (x > y) .
__DEVICE__ bool isnan(float __x)
Test for a NaN.
__DEVICE__ int fpclassify(float __x)
__DEVICE__ bool isfinite(float __x)
Test for finite value.
__DEVICE__ bool signbit(float __x)
Test for sign bit.
__DEVICE__ bool isinf(float __x)
Test for infinity value (+ve or -ve) .
__DEVICE__ float modf(float __x, float *__iptr)
Decompose a floating-point number.
#define __CUDA_CLANG_FN_INTEGER_OVERLOAD_1(__retty, __fn)
__DEVICE__ bool islessequal(float __x, float __y)
Returns the component-wise compare of x <= y.
#define __CUDA_CLANG_FN_INTEGER_OVERLOAD_2(__retty, __fn)
__DEVICE__ long long abs(long long __n)
__DEVICE__ bool isless(float __x, float __y)
Returns the component-wise compare of x < y.
__DEVICE__ bool isnormal(float __x)
Test for a normal value.
__DEVICE__ bool isgreaterequal(float __x, float __y)
Returns the component-wise compare of x >= y.
static __inline unsigned char unsigned int __x
static __inline unsigned char unsigned int unsigned int __y
#define scalbln(__x, __y)
#define copysign(__x, __y)
#define remquo(__x, __y, __z)
#define nextafter(__x, __y)
#define remainder(__x, __y)
#define fma(__x, __y, __z)