|
| 1 | +#ifndef _MATH_DEF_H |
| 2 | +#define _MATH_DEF_H |
| 3 | + |
| 4 | +#include <stdbool.h> |
| 5 | + |
| 6 | +#define NAN __builtin_nanf("") |
| 7 | +#define INFINITY __builtin_inff() |
| 8 | + |
| 9 | +#define HUGE_VALF __builtin_inff() |
| 10 | +#define HUGE_VAL __builtin_inf() |
| 11 | +#define HUGE_VALL __builtin_infl() |
| 12 | + |
| 13 | +#define M_E 2.71828182845904523536 /* e */ |
| 14 | +#define M_LOG2E 1.44269504088896340736 /* log2(e) */ |
| 15 | +#define M_LOG10E 0.434294481903251827651 /* log10(e) */ |
| 16 | +#define M_LN2 0.693147180559945309417 /* ln(2) */ |
| 17 | +#define M_LN10 2.30258509299404568402 /* ln(10) */ |
| 18 | +#define M_PI 3.14159265358979323846 /* pi */ |
| 19 | +#define M_PI_2 1.57079632679489661923 /* pi/2 */ |
| 20 | +#define M_PI_4 0.785398163397448309616 /* pi/4 */ |
| 21 | +#define M_1_PI 0.318309886183790671538 /* 1/pi */ |
| 22 | +#define M_2_PI 0.636619772367581343076 /* 2/pi */ |
| 23 | +#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ |
| 24 | +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ |
| 25 | +#define M_SQRT1_2 0.707106781186547524401 /* 1/sqrt(2) */ |
| 26 | + |
| 27 | +#define FP_ILOGB0 (~__INT_MAX__) |
| 28 | +#define FP_ILOGBNAN __INT_MAX__ |
| 29 | + |
| 30 | +#define FP_ZERO 0x0 |
| 31 | +#define FP_INFINITE 0x1 |
| 32 | +#define FP_SUBNORMAL 0x2 |
| 33 | +#define FP_NAN 0x3 |
| 34 | +#define FP_NORMAL 0x4 |
| 35 | + |
| 36 | +typedef float float_t; |
| 37 | +typedef double double_t; |
| 38 | + |
| 39 | +#ifdef __cplusplus |
| 40 | +extern "C" { |
| 41 | +#endif |
| 42 | + |
| 43 | +int _fpclassifyf(float n); |
| 44 | +int _fpclassifyl(long double n); |
| 45 | + |
| 46 | +int _isinff(float n); |
| 47 | +int _isnanf(float n); |
| 48 | +int _isnormalf(float n); |
| 49 | +int _isfinitef(float n); |
| 50 | +int _iszerof(float n); |
| 51 | +int _issubnormalf(float n); |
| 52 | + |
| 53 | +int _isinfl(long double n); |
| 54 | +int _isnanl(long double n); |
| 55 | +int _isnormall(long double n); |
| 56 | +int _isfinitel(long double n); |
| 57 | +int _iszerol(long double n); |
| 58 | +int _issubnormall(long double n); |
| 59 | + |
| 60 | +#if 0 |
| 61 | +/* disabled until builtin is optimized */ |
| 62 | +#define _signbitf(x) __builtin_signbit(x) |
| 63 | +#define _signbitl(x) __builtin_signbit(x) |
| 64 | +#else |
| 65 | +bool _signbitf(float x); |
| 66 | +bool _signbitl(long double x); |
| 67 | +#endif |
| 68 | + |
| 69 | +double acos(double); |
| 70 | +float acosf(float); |
| 71 | +long double acosl(long double); |
| 72 | + |
| 73 | +double acosh(double); |
| 74 | +float acoshf(float); |
| 75 | +long double acoshl(long double); |
| 76 | + |
| 77 | +double asin(double); |
| 78 | +float asinf(float); |
| 79 | +long double asinl(long double); |
| 80 | + |
| 81 | +double asinh(double); |
| 82 | +float asinhf(float); |
| 83 | +long double asinhl(long double); |
| 84 | + |
| 85 | +double atan(double); |
| 86 | +float atanf(float); |
| 87 | +long double atanl(long double); |
| 88 | + |
| 89 | +double atan2(double, double); |
| 90 | +float atan2f(float, float); |
| 91 | +long double atan2l(long double, long double); |
| 92 | + |
| 93 | +double atanh(double); |
| 94 | +float atanhf(float); |
| 95 | +long double atanhl(long double); |
| 96 | + |
| 97 | +double cbrt(double); |
| 98 | +float cbrtf(float); |
| 99 | +long double cbrtl(long double); |
| 100 | + |
| 101 | +double ceil(double); |
| 102 | +float ceilf(float); |
| 103 | +long double ceill(long double); |
| 104 | + |
| 105 | +double copysign(double, double); |
| 106 | +float copysignf(float, float); |
| 107 | +long double copysignl(long double, long double); |
| 108 | + |
| 109 | +double cos(double); |
| 110 | +float cosf(float); |
| 111 | +long double cosl(long double); |
| 112 | + |
| 113 | +double cosh(double); |
| 114 | +float coshf(float); |
| 115 | +long double coshl(long double); |
| 116 | + |
| 117 | +double erf(double); |
| 118 | +float erff(float); |
| 119 | +long double erfl(long double); |
| 120 | + |
| 121 | +double erfc(double); |
| 122 | +float erfcf(float); |
| 123 | +long double erfcl(long double); |
| 124 | + |
| 125 | +double exp(double); |
| 126 | +float expf(float); |
| 127 | +long double expl(long double); |
| 128 | + |
| 129 | +double exp2(double); |
| 130 | +float exp2f(float); |
| 131 | +long double exp2l(long double); |
| 132 | + |
| 133 | +double expm1(double); |
| 134 | +float expm1f(float); |
| 135 | +long double expm1l(long double); |
| 136 | + |
| 137 | +#ifndef _ABS_FLOAT_DEFINED |
| 138 | +#define _ABS_FLOAT_DEFINED |
| 139 | +double fabs(double); |
| 140 | +float fabsf(float); |
| 141 | +long double fabsl(long double); |
| 142 | +#endif /* _ABS_FLOAT_DEFINED */ |
| 143 | + |
| 144 | +double fdim(double, double); |
| 145 | +float fdimf(float, float); |
| 146 | +long double fdiml(long double, long double); |
| 147 | + |
| 148 | +double floor(double); |
| 149 | +float floorf(float); |
| 150 | +long double floorl(long double); |
| 151 | + |
| 152 | +double fma(double, double, double); |
| 153 | +float fmaf(float, float, float); |
| 154 | +long double fmal(long double, long double, long double); |
| 155 | + |
| 156 | +double fmax(double, double); |
| 157 | +float fmaxf(float, float); |
| 158 | +long double fmaxl(long double, long double); |
| 159 | + |
| 160 | +double fmin(double, double); |
| 161 | +float fminf(float, float); |
| 162 | +long double fminl(long double, long double); |
| 163 | + |
| 164 | +double fmod(double, double); |
| 165 | +float fmodf(float, float); |
| 166 | +long double fmodl(long double, long double); |
| 167 | + |
| 168 | +double frexp(double, int *); |
| 169 | +float frexpf(float, int *); |
| 170 | +long double frexpl(long double, int *); |
| 171 | + |
| 172 | +double hypot(double, double); |
| 173 | +float hypotf(float, float); |
| 174 | +long double hypotl(long double, long double); |
| 175 | + |
| 176 | +double __hypot3(double, double, double); |
| 177 | +float __hypot3f(float, float, float); |
| 178 | +long double __hypot3l(long double, long double, long double); |
| 179 | + |
| 180 | +int ilogb(double); |
| 181 | +int ilogbf(float); |
| 182 | +int ilogbl(long double); |
| 183 | + |
| 184 | +double ldexp(double, int); |
| 185 | +float ldexpf(float, int); |
| 186 | +long double ldexpl(long double, int); |
| 187 | + |
| 188 | +double lgamma(double); |
| 189 | +float lgammaf(float); |
| 190 | +long double lgammal(long double); |
| 191 | + |
| 192 | +long long llrint(double); |
| 193 | +long long llrintf(float); |
| 194 | +long long llrintl(long double); |
| 195 | + |
| 196 | +long long llround(double); |
| 197 | +long long llroundf(float); |
| 198 | +long long llroundl(long double); |
| 199 | + |
| 200 | +double log(double); |
| 201 | +float logf(float); |
| 202 | +long double logl(long double); |
| 203 | + |
| 204 | +double log10(double); |
| 205 | +float log10f(float); |
| 206 | +long double log10l(long double); |
| 207 | + |
| 208 | +double log1p(double); |
| 209 | +float log1pf(float); |
| 210 | +long double log1pl(long double); |
| 211 | + |
| 212 | +double log2(double); |
| 213 | +float log2f(float); |
| 214 | +long double log2l(long double); |
| 215 | + |
| 216 | +double logb(double); |
| 217 | +float logbf(float); |
| 218 | +long double logbl(long double); |
| 219 | + |
| 220 | +long lrint(double); |
| 221 | +long lrintf(float); |
| 222 | +long lrintl(long double); |
| 223 | + |
| 224 | +long lround(double); |
| 225 | +long lroundf(float); |
| 226 | +long lroundl(long double); |
| 227 | + |
| 228 | +double modf(double, double *); |
| 229 | +float modff(float, float *); |
| 230 | +long double modfl(long double, long double *); |
| 231 | + |
| 232 | +double nan(const char *); |
| 233 | +float nanf(const char *); |
| 234 | +long double nanl(const char *); |
| 235 | + |
| 236 | +double nearbyint(double); |
| 237 | +float nearbyintf(float); |
| 238 | +long double nearbyintl(long double); |
| 239 | + |
| 240 | +double nextafter(double, double); |
| 241 | +float nextafterf(float, float); |
| 242 | +long double nextafterl(long double, long double); |
| 243 | + |
| 244 | +double nextdown(double); |
| 245 | +float nextdownf(float); |
| 246 | +long double nextdownl(long double); |
| 247 | + |
| 248 | +double nexttoward(double, long double); |
| 249 | +float nexttowardf(float, long double); |
| 250 | +long double nexttowardl(long double, long double); |
| 251 | + |
| 252 | +double nextup(double); |
| 253 | +float nextupf(float); |
| 254 | +long double nextupl(long double); |
| 255 | + |
| 256 | +double pow(double, double); |
| 257 | +float powf(float, float); |
| 258 | +long double powl(long double, long double); |
| 259 | + |
| 260 | +double remainder(double, double); |
| 261 | +float remainderf(float, float); |
| 262 | +long double remainderl(long double, long double); |
| 263 | + |
| 264 | +double remquo(double, double, int *); |
| 265 | +float remquof(float, float, int *); |
| 266 | +long double remquol(long double, long double, int *); |
| 267 | + |
| 268 | +double rint(double); |
| 269 | +float rintf(float); |
| 270 | +long double rintl(long double); |
| 271 | + |
| 272 | +double round(double); |
| 273 | +float roundf(float); |
| 274 | +long double roundl(long double); |
| 275 | + |
| 276 | +double roundeven(double); |
| 277 | +float roundevenf(float); |
| 278 | +long double roundevenl(long double); |
| 279 | + |
| 280 | +double scalbln(double, long); |
| 281 | +float scalblnf(float, long); |
| 282 | +long double scalblnl(long double, long); |
| 283 | + |
| 284 | +double scalbn(double, int); |
| 285 | +float scalbnf(float, int); |
| 286 | +long double scalbnl(long double, int); |
| 287 | + |
| 288 | +double sin(double); |
| 289 | +float sinf(float); |
| 290 | +long double sinl(long double); |
| 291 | + |
| 292 | +double sinh(double); |
| 293 | +float sinhf(float); |
| 294 | +long double sinhl(long double); |
| 295 | + |
| 296 | +double sqrt(double); |
| 297 | +float sqrtf(float); |
| 298 | +long double sqrtl(long double); |
| 299 | + |
| 300 | +double tan(double); |
| 301 | +float tanf(float); |
| 302 | +long double tanl(long double); |
| 303 | + |
| 304 | +double tanh(double); |
| 305 | +float tanhf(float); |
| 306 | +long double tanhl(long double); |
| 307 | + |
| 308 | +double tgamma(double); |
| 309 | +float tgammaf(float); |
| 310 | +long double tgammal(long double); |
| 311 | + |
| 312 | +double trunc(double); |
| 313 | +float truncf(float); |
| 314 | +long double truncl(long double); |
| 315 | + |
| 316 | +/* aliases */ |
| 317 | + |
| 318 | +long double _debug_fabsl(long double); |
| 319 | +#define fabsl _debug_fabsl |
| 320 | +long double _debug_copysignl(long double, long double); |
| 321 | +#define copysignl _debug_copysignl |
| 322 | +long double _debug_fmaxl(long double, long double); |
| 323 | +#define fmaxl _debug_fmaxl |
| 324 | +long double _debug_fminl(long double, long double); |
| 325 | +#define fminl _debug_fminl |
| 326 | +long double _debug_truncl(long double); |
| 327 | +#define truncl _debug_truncl |
| 328 | +long double _debug_floorl(long double); |
| 329 | +#define floorl _debug_floorl |
| 330 | +long double _debug_ceill(long double); |
| 331 | +#define ceill _debug_ceill |
| 332 | +long double _debug_roundl(long double); |
| 333 | +#define roundl _debug_roundl |
| 334 | +long double _debug_nearbyintl(long double); |
| 335 | +#define nearbyintl _debug_nearbyintl |
| 336 | +long double _debug_rintl(long double); |
| 337 | +#define rintl _debug_rintl |
| 338 | +long double _debug_fmal(long double, long double, long double); |
| 339 | +#define fmal _debug_fmal |
| 340 | + |
| 341 | +#ifdef __cplusplus |
| 342 | +} |
| 343 | +#endif |
| 344 | + |
| 345 | +#endif /* _MATH_DEF_H */ |
0 commit comments