| 1 |
#pragma once |
| 2 |
|
| 3 |
// __clang_cuda_(c)math(.h) also provide `abs` which actually belong in |
| 4 |
// cstdlib. We could split them out but for now we just include cstdlib from |
| 5 |
// cmath.h which is what the systems I've seen do as well. |
| 6 |
#include <cstdlib> |
| 7 |
|
| 8 |
#include <math.h> |
| 9 |
|
| 10 |
double acos(double); |
| 11 |
float acos(float); |
| 12 |
double acosh(double); |
| 13 |
float acosh(float); |
| 14 |
double asin(double); |
| 15 |
float asin(float); |
| 16 |
double asinh(double); |
| 17 |
float asinh(float); |
| 18 |
double atan2(double, double); |
| 19 |
float atan2(float, float); |
| 20 |
double atan(double); |
| 21 |
float atan(float); |
| 22 |
double atanh(double); |
| 23 |
float atanh(float); |
| 24 |
double cbrt(double); |
| 25 |
float cbrt(float); |
| 26 |
double ceil(double); |
| 27 |
float ceil(float); |
| 28 |
double copysign(double, double); |
| 29 |
float copysign(float, float); |
| 30 |
double cos(double); |
| 31 |
float cos(float); |
| 32 |
double cosh(double); |
| 33 |
float cosh(float); |
| 34 |
double erfc(double); |
| 35 |
float erfc(float); |
| 36 |
double erf(double); |
| 37 |
float erf(float); |
| 38 |
double exp2(double); |
| 39 |
float exp2(float); |
| 40 |
double exp(double); |
| 41 |
float exp(float); |
| 42 |
double expm1(double); |
| 43 |
float expm1(float); |
| 44 |
double fdim(double, double); |
| 45 |
float fdim(float, float); |
| 46 |
double floor(double); |
| 47 |
float floor(float); |
| 48 |
double fma(double, double, double); |
| 49 |
float fma(float, float, float); |
| 50 |
double fmax(double, double); |
| 51 |
float fmax(float, float); |
| 52 |
float max(float, float); |
| 53 |
double max(double, double); |
| 54 |
double fmin(double, double); |
| 55 |
float fmin(float, float); |
| 56 |
float min(float, float); |
| 57 |
double min(double, double); |
| 58 |
double fmod(double, double); |
| 59 |
float fmod(float, float); |
| 60 |
int fpclassify(double); |
| 61 |
int fpclassify(float); |
| 62 |
double frexp(double, int *); |
| 63 |
float frexp(float, int *); |
| 64 |
double hypot(double, double); |
| 65 |
float hypot(float, float); |
| 66 |
int ilogb(double); |
| 67 |
int ilogb(float); |
| 68 |
bool isfinite(long double); |
| 69 |
bool isfinite(double); |
| 70 |
bool isfinite(float); |
| 71 |
bool isgreater(double, double); |
| 72 |
bool isgreaterequal(double, double); |
| 73 |
bool isgreaterequal(float, float); |
| 74 |
bool isgreater(float, float); |
| 75 |
bool isinf(long double); |
| 76 |
bool isinf(double); |
| 77 |
bool isinf(float); |
| 78 |
bool isless(double, double); |
| 79 |
bool islessequal(double, double); |
| 80 |
bool islessequal(float, float); |
| 81 |
bool isless(float, float); |
| 82 |
bool islessgreater(double, double); |
| 83 |
bool islessgreater(float, float); |
| 84 |
bool isnan(long double); |
| 85 |
#ifdef USE_ISNAN_WITH_INT_RETURN |
| 86 |
int isnan(double); |
| 87 |
int isnan(float); |
| 88 |
#else |
| 89 |
bool isnan(double); |
| 90 |
bool isnan(float); |
| 91 |
#endif |
| 92 |
bool isnormal(double); |
| 93 |
bool isnormal(float); |
| 94 |
bool isunordered(double, double); |
| 95 |
bool isunordered(float, float); |
| 96 |
double ldexp(double, int); |
| 97 |
float ldexp(float, int); |
| 98 |
double lgamma(double); |
| 99 |
float lgamma(float); |
| 100 |
long long llrint(double); |
| 101 |
long long llrint(float); |
| 102 |
double log10(double); |
| 103 |
float log10(float); |
| 104 |
double log1p(double); |
| 105 |
float log1p(float); |
| 106 |
double log2(double); |
| 107 |
float log2(float); |
| 108 |
double logb(double); |
| 109 |
float logb(float); |
| 110 |
double log(double); |
| 111 |
float log(float); |
| 112 |
long lrint(double); |
| 113 |
long lrint(float); |
| 114 |
long lround(double); |
| 115 |
long lround(float); |
| 116 |
long long llround(float); // No llround(double). |
| 117 |
double modf(double, double *); |
| 118 |
float modf(float, float *); |
| 119 |
double nan(const char *); |
| 120 |
float nanf(const char *); |
| 121 |
double nearbyint(double); |
| 122 |
float nearbyint(float); |
| 123 |
double nextafter(double, double); |
| 124 |
float nextafter(float, float); |
| 125 |
double pow(double, double); |
| 126 |
double pow(double, int); |
| 127 |
float pow(float, float); |
| 128 |
float pow(float, int); |
| 129 |
double remainder(double, double); |
| 130 |
float remainder(float, float); |
| 131 |
double remquo(double, double, int *); |
| 132 |
float remquo(float, float, int *); |
| 133 |
double rint(double); |
| 134 |
float rint(float); |
| 135 |
double round(double); |
| 136 |
float round(float); |
| 137 |
double scalbln(double, long); |
| 138 |
float scalbln(float, long); |
| 139 |
double scalbn(double, int); |
| 140 |
float scalbn(float, int); |
| 141 |
bool signbit(double); |
| 142 |
bool signbit(float); |
| 143 |
long double sin(long double); |
| 144 |
double sin(double); |
| 145 |
float sin(float); |
| 146 |
double sinh(double); |
| 147 |
float sinh(float); |
| 148 |
double sqrt(double); |
| 149 |
float sqrt(float); |
| 150 |
double tan(double); |
| 151 |
float tan(float); |
| 152 |
double tanh(double); |
| 153 |
float tanh(float); |
| 154 |
double tgamma(double); |
| 155 |
float tgamma(float); |
| 156 |
double trunc(double); |
| 157 |
float trunc(float); |
| 158 |
|
| 159 |
namespace std { |
| 160 |
|
| 161 |
using ::acos; |
| 162 |
using ::acosh; |
| 163 |
using ::asin; |
| 164 |
using ::asinh; |
| 165 |
using ::atan; |
| 166 |
using ::atan2; |
| 167 |
using ::atanh; |
| 168 |
using ::cbrt; |
| 169 |
using ::ceil; |
| 170 |
using ::copysign; |
| 171 |
using ::cos; |
| 172 |
using ::cosh; |
| 173 |
using ::erf; |
| 174 |
using ::erfc; |
| 175 |
using ::exp; |
| 176 |
using ::exp2; |
| 177 |
using ::expm1; |
| 178 |
using ::fdim; |
| 179 |
using ::floor; |
| 180 |
using ::fma; |
| 181 |
using ::fmax; |
| 182 |
using ::fmin; |
| 183 |
using ::fmod; |
| 184 |
using ::fpclassify; |
| 185 |
using ::frexp; |
| 186 |
using ::hypot; |
| 187 |
using ::ilogb; |
| 188 |
using ::isfinite; |
| 189 |
using ::isgreater; |
| 190 |
using ::isgreaterequal; |
| 191 |
using ::isinf; |
| 192 |
using ::isless; |
| 193 |
using ::islessequal; |
| 194 |
using ::islessgreater; |
| 195 |
using ::isnan; |
| 196 |
using ::isnormal; |
| 197 |
using ::isunordered; |
| 198 |
using ::ldexp; |
| 199 |
using ::lgamma; |
| 200 |
using ::llrint; |
| 201 |
using ::log; |
| 202 |
using ::log10; |
| 203 |
using ::log1p; |
| 204 |
using ::log2; |
| 205 |
using ::logb; |
| 206 |
using ::lrint; |
| 207 |
using ::lround; |
| 208 |
using ::llround; |
| 209 |
using ::modf; |
| 210 |
using ::nan; |
| 211 |
using ::nanf; |
| 212 |
using ::nearbyint; |
| 213 |
using ::nextafter; |
| 214 |
using ::pow; |
| 215 |
using ::remainder; |
| 216 |
using ::remquo; |
| 217 |
using ::rint; |
| 218 |
using ::round; |
| 219 |
using ::scalbln; |
| 220 |
using ::scalbn; |
| 221 |
using ::signbit; |
| 222 |
using ::sin; |
| 223 |
using ::sinh; |
| 224 |
using ::sqrt; |
| 225 |
using ::tan; |
| 226 |
using ::tanh; |
| 227 |
using ::tgamma; |
| 228 |
using ::trunc; |
| 229 |
|
| 230 |
} // namespace std |
| 231 |
|
| 232 |
#define FP_NAN 0 |
| 233 |
#define FP_INFINITE 1 |
| 234 |
#define FP_ZERO 2 |
| 235 |
#define FP_SUBNORMAL 3 |
| 236 |
#define FP_NORMAL 4 |