1 //===-- C standard library header math.h ----------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIBC_MATH_H 10 #define LLVM_LIBC_MATH_H 11 12 #include "__llvm-libc-common.h" 13 #include "llvm-libc-macros/float16-macros.h" 14 #include "llvm-libc-macros/math-macros.h" 15 #include "llvm-libc-types/float128.h" 16 17 18 #include <llvm-libc-types/float_t.h> 19 #include <llvm-libc-types/double_t.h> 20 21 #if !defined(__LIBC_CONST_ATTR) && defined(__cplusplus) && defined(__GNUC__) 22 #if __has_attribute(const) 23 #define __LIBC_CONST_ATTR [[gnu::const]] 24 #endif 25 #endif 26 #if !defined(__LIBC_CONST_ATTR) && defined(__GNUC__) 27 #if __has_attribute(const) 28 #define __LIBC_CONST_ATTR __attribute__((const)) 29 #endif 30 #endif 31 #if !defined(__LIBC_CONST_ATTR) 32 #define __LIBC_CONST_ATTR 33 #endif 34 35 __BEGIN_C_DECLS 36 37 float acosf(float) __NOEXCEPT; 38 39 float acoshf(float) __NOEXCEPT; 40 41 float asinf(float) __NOEXCEPT; 42 43 float asinhf(float) __NOEXCEPT; 44 45 double atan2(double, double) __NOEXCEPT; 46 47 float atan2f(float, float) __NOEXCEPT; 48 49 float atanf(float) __NOEXCEPT; 50 51 float atanhf(float) __NOEXCEPT; 52 53 int canonicalize(double, double) __NOEXCEPT; 54 55 int canonicalizef(float, float) __NOEXCEPT; 56 57 int canonicalizel(long double, long double) __NOEXCEPT; 58 59 double cbrt(double) __NOEXCEPT; 60 61 float cbrtf(float) __NOEXCEPT; 62 63 double ceil(double) __NOEXCEPT; 64 65 float ceilf(float) __NOEXCEPT; 66 67 long double ceill(long double) __NOEXCEPT; 68 69 double copysign(double, double) __NOEXCEPT; 70 71 float copysignf(float, float) __NOEXCEPT; 72 73 long double copysignl(long double, long double) __NOEXCEPT; 74 75 double cos(double) __NOEXCEPT; 76 77 float cosf(float) __NOEXCEPT; 78 79 float coshf(float) __NOEXCEPT; 80 81 float erff(float) __NOEXCEPT; 82 83 double exp(double) __NOEXCEPT; 84 85 double exp10(double) __NOEXCEPT; 86 87 float exp10f(float) __NOEXCEPT; 88 89 double exp2(double) __NOEXCEPT; 90 91 float exp2f(float) __NOEXCEPT; 92 93 float exp2m1f(float) __NOEXCEPT; 94 95 float expf(float) __NOEXCEPT; 96 97 double expm1(double) __NOEXCEPT; 98 99 float expm1f(float) __NOEXCEPT; 100 101 __LIBC_CONST_ATTR double fabs(double) __NOEXCEPT; 102 103 float fabsf(float) __NOEXCEPT; 104 105 long double fabsl(long double) __NOEXCEPT; 106 107 double fdim(double, double) __NOEXCEPT; 108 109 float fdimf(float, float) __NOEXCEPT; 110 111 long double fdiml(long double, long double) __NOEXCEPT; 112 113 double floor(double) __NOEXCEPT; 114 115 float floorf(float) __NOEXCEPT; 116 117 long double floorl(long double) __NOEXCEPT; 118 119 double fma(double, double, double) __NOEXCEPT; 120 121 float fmaf(float, float, float) __NOEXCEPT; 122 123 double fmax(double, double) __NOEXCEPT; 124 125 float fmaxf(float, float) __NOEXCEPT; 126 127 double fmaximum(double, double) __NOEXCEPT; 128 129 double fmaximum_mag(double, double) __NOEXCEPT; 130 131 double fmaximum_mag_num(double, double) __NOEXCEPT; 132 133 float fmaximum_mag_numf(float, float) __NOEXCEPT; 134 135 long double fmaximum_mag_numl(long double, long double) __NOEXCEPT; 136 137 float fmaximum_magf(float, float) __NOEXCEPT; 138 139 long double fmaximum_magl(long double, long double) __NOEXCEPT; 140 141 double fmaximum_num(double, double) __NOEXCEPT; 142 143 float fmaximum_numf(float, float) __NOEXCEPT; 144 145 long double fmaximum_numl(long double, long double) __NOEXCEPT; 146 147 float fmaximumf(float, float) __NOEXCEPT; 148 149 long double fmaximuml(long double, long double) __NOEXCEPT; 150 151 long double fmaxl(long double, long double) __NOEXCEPT; 152 153 double fmin(double, double) __NOEXCEPT; 154 155 float fminf(float, float) __NOEXCEPT; 156 157 double fminimum(double, double) __NOEXCEPT; 158 159 double fminimum_mag(double, double) __NOEXCEPT; 160 161 double fminimum_mag_num(double, double) __NOEXCEPT; 162 163 float fminimum_mag_numf(float, float) __NOEXCEPT; 164 165 long double fminimum_mag_numl(long double, long double) __NOEXCEPT; 166 167 float fminimum_magf(float, float) __NOEXCEPT; 168 169 long double fminimum_magl(long double, long double) __NOEXCEPT; 170 171 double fminimum_num(double, double) __NOEXCEPT; 172 173 float fminimum_numf(float, float) __NOEXCEPT; 174 175 float fminimumf(float, float) __NOEXCEPT; 176 177 long double fminimuml(long double, long double) __NOEXCEPT; 178 179 long double fminl(long double, long double) __NOEXCEPT; 180 181 double fmod(double, double) __NOEXCEPT; 182 183 float fmodf(float, float) __NOEXCEPT; 184 185 float fmul(double, double) __NOEXCEPT; 186 187 double frexp(double, int *) __NOEXCEPT; 188 189 float frexpf(float, int *) __NOEXCEPT; 190 191 long double frexpl(long double, int *) __NOEXCEPT; 192 193 double fromfp(double, int, unsigned int) __NOEXCEPT; 194 195 float fromfpf(float, int, unsigned int) __NOEXCEPT; 196 197 long double fromfpl(long double, int, unsigned int) __NOEXCEPT; 198 199 double fromfpx(double, int, unsigned int) __NOEXCEPT; 200 201 float fromfpxf(float, int, unsigned int) __NOEXCEPT; 202 203 long double fromfpxl(long double, int, unsigned int) __NOEXCEPT; 204 205 double hypot(double, double) __NOEXCEPT; 206 207 float hypotf(float, float) __NOEXCEPT; 208 209 int ilogb(double) __NOEXCEPT; 210 211 int ilogbf(float) __NOEXCEPT; 212 213 int ilogbl(long double) __NOEXCEPT; 214 215 int isnan(double) __NOEXCEPT; 216 217 int isnanf(float) __NOEXCEPT; 218 219 int isnanl(long double) __NOEXCEPT; 220 221 double ldexp(double, int) __NOEXCEPT; 222 223 float ldexpf(float, int) __NOEXCEPT; 224 225 long double ldexpl(long double, int) __NOEXCEPT; 226 227 long llogb(double) __NOEXCEPT; 228 229 long llogbf(float) __NOEXCEPT; 230 231 long llogbl(long double) __NOEXCEPT; 232 233 long long llrint(double) __NOEXCEPT; 234 235 long long llrintf(float) __NOEXCEPT; 236 237 long long llrintl(long double) __NOEXCEPT; 238 239 long long llround(double) __NOEXCEPT; 240 241 long long llroundf(float) __NOEXCEPT; 242 243 long long llroundl(long double) __NOEXCEPT; 244 245 double log(double) __NOEXCEPT; 246 247 double log10(double) __NOEXCEPT; 248 249 float log10f(float) __NOEXCEPT; 250 251 double log1p(double) __NOEXCEPT; 252 253 float log1pf(float) __NOEXCEPT; 254 255 double log2(double) __NOEXCEPT; 256 257 float log2f(float) __NOEXCEPT; 258 259 double logb(double) __NOEXCEPT; 260 261 float logbf(float) __NOEXCEPT; 262 263 long double logbl(long double) __NOEXCEPT; 264 265 float logf(float) __NOEXCEPT; 266 267 long lrint(double) __NOEXCEPT; 268 269 long lrintf(float) __NOEXCEPT; 270 271 long lrintl(long double) __NOEXCEPT; 272 273 long lround(double) __NOEXCEPT; 274 275 long lroundf(float) __NOEXCEPT; 276 277 long lroundl(long double) __NOEXCEPT; 278 279 double modf(double, double *) __NOEXCEPT; 280 281 float modff(float, float *) __NOEXCEPT; 282 283 long double modfl(long double, long double *) __NOEXCEPT; 284 285 double nan(const char *) __NOEXCEPT; 286 287 float nanf(const char *) __NOEXCEPT; 288 289 long double nanl(const char *) __NOEXCEPT; 290 291 double nearbyint(double) __NOEXCEPT; 292 293 float nearbyintf(float) __NOEXCEPT; 294 295 long double nearbyintl(long double) __NOEXCEPT; 296 297 double nextafter(double, double) __NOEXCEPT; 298 299 float nextafterf(float, float) __NOEXCEPT; 300 301 long double nextafterl(long double, long double) __NOEXCEPT; 302 303 double nextdown(double) __NOEXCEPT; 304 305 float nextdownf(float) __NOEXCEPT; 306 307 long double nextdownl(long double) __NOEXCEPT; 308 309 double nexttoward(double, long double) __NOEXCEPT; 310 311 float nexttowardf(float, long double) __NOEXCEPT; 312 313 long double nexttowardl(long double, long double) __NOEXCEPT; 314 315 double nextup(double) __NOEXCEPT; 316 317 float nextupf(float) __NOEXCEPT; 318 319 long double nextupl(long double) __NOEXCEPT; 320 321 double pow(double, double) __NOEXCEPT; 322 323 float powf(float, float) __NOEXCEPT; 324 325 double remainder(double, double) __NOEXCEPT; 326 327 float remainderf(float, float) __NOEXCEPT; 328 329 long double remainderl(long double, long double) __NOEXCEPT; 330 331 double remquo(double, double, int *) __NOEXCEPT; 332 333 float remquof(float, float, int *) __NOEXCEPT; 334 335 long double remquol(long double, long double, int *) __NOEXCEPT; 336 337 double rint(double) __NOEXCEPT; 338 339 float rintf(float) __NOEXCEPT; 340 341 long double rintl(long double) __NOEXCEPT; 342 343 double round(double) __NOEXCEPT; 344 345 double roundeven(double) __NOEXCEPT; 346 347 float roundevenf(float) __NOEXCEPT; 348 349 long double roundevenl(long double) __NOEXCEPT; 350 351 float roundf(float) __NOEXCEPT; 352 353 long double roundl(long double) __NOEXCEPT; 354 355 double scalbln(double, long) __NOEXCEPT; 356 357 float scalblnf(float, long) __NOEXCEPT; 358 359 long double scalblnl(long double, long) __NOEXCEPT; 360 361 double scalbn(double, int) __NOEXCEPT; 362 363 float scalbnf(float, int) __NOEXCEPT; 364 365 long double scalbnl(long double, int) __NOEXCEPT; 366 367 double sin(double) __NOEXCEPT; 368 369 float sinf(float) __NOEXCEPT; 370 371 float sinhf(float) __NOEXCEPT; 372 373 double sqrt(double) __NOEXCEPT; 374 375 float sqrtf(float) __NOEXCEPT; 376 377 long double sqrtl(long double) __NOEXCEPT; 378 379 double tan(double) __NOEXCEPT; 380 381 float tanf(float) __NOEXCEPT; 382 383 float tanhf(float) __NOEXCEPT; 384 385 double trunc(double) __NOEXCEPT; 386 387 float truncf(float) __NOEXCEPT; 388 389 long double truncl(long double) __NOEXCEPT; 390 391 double ufromfp(double, int, unsigned int) __NOEXCEPT; 392 393 float ufromfpf(float, int, unsigned int) __NOEXCEPT; 394 395 long double ufromfpl(long double, int, unsigned int) __NOEXCEPT; 396 397 double ufromfpx(double, int, unsigned int) __NOEXCEPT; 398 399 float ufromfpxf(float, int, unsigned int) __NOEXCEPT; 400 401 long double ufromfpxl(long double, int, unsigned int) __NOEXCEPT; 402 403 __END_C_DECLS 404 405 #undef __LIBC_CONST_ATTR 406 407 408 #include "llvm-libc-macros/math-function-macros.h" 409 410 #endif // LLVM_LIBC_MATH_H 411