The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /* |
| 2 | * ==================================================== |
| 3 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
| 4 | * |
| 5 | * Developed at SunPro, a Sun Microsystems, Inc. business. |
| 6 | * Permission to use, copy, modify, and distribute this |
| 7 | * software is freely granted, provided that this notice |
| 8 | * is preserved. |
| 9 | * ==================================================== |
| 10 | */ |
| 11 | |
| 12 | /* |
| 13 | * from: @(#)fdlibm.h 5.1 93/09/24 |
Elliott Hughes | a0ee078 | 2013-01-30 19:06:37 -0800 | [diff] [blame] | 14 | * $FreeBSD$ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #ifndef _MATH_H_ |
Elliott Hughes | b662280 | 2015-08-14 14:04:30 -0700 | [diff] [blame] | 18 | #define _MATH_H_ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 19 | |
| 20 | #include <sys/cdefs.h> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 21 | #include <limits.h> |
| 22 | |
Elliott Hughes | de9ac71 | 2014-05-19 16:58:52 -0700 | [diff] [blame] | 23 | __BEGIN_DECLS |
Elliott Hughes | de9ac71 | 2014-05-19 16:58:52 -0700 | [diff] [blame] | 24 | |
Elliott Hughes | b662280 | 2015-08-14 14:04:30 -0700 | [diff] [blame] | 25 | #define HUGE_VAL __builtin_huge_val() |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 26 | |
Elliott Hughes | b662280 | 2015-08-14 14:04:30 -0700 | [diff] [blame] | 27 | #define FP_ILOGB0 (-INT_MAX) |
| 28 | #define FP_ILOGBNAN INT_MAX |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 29 | |
Elliott Hughes | b662280 | 2015-08-14 14:04:30 -0700 | [diff] [blame] | 30 | #define HUGE_VALF __builtin_huge_valf() |
| 31 | #define HUGE_VALL __builtin_huge_vall() |
| 32 | #define INFINITY __builtin_inff() |
| 33 | #define NAN __builtin_nanf("") |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 34 | |
Elliott Hughes | b662280 | 2015-08-14 14:04:30 -0700 | [diff] [blame] | 35 | #define MATH_ERRNO 1 |
| 36 | #define MATH_ERREXCEPT 2 |
| 37 | #define math_errhandling MATH_ERREXCEPT |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 38 | |
Elliott Hughes | b662280 | 2015-08-14 14:04:30 -0700 | [diff] [blame] | 39 | #if defined(__FP_FAST_FMA) |
| 40 | #define FP_FAST_FMA 1 |
| 41 | #endif |
| 42 | #if defined(__FP_FAST_FMAF) |
| 43 | #define FP_FAST_FMAF 1 |
| 44 | #endif |
| 45 | #if defined(__FP_FAST_FMAL) |
| 46 | #define FP_FAST_FMAL 1 |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 47 | #endif |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 48 | |
| 49 | /* Symbolic constants to classify floating point numbers. */ |
Elliott Hughes | b662280 | 2015-08-14 14:04:30 -0700 | [diff] [blame] | 50 | #define FP_INFINITE 0x01 |
| 51 | #define FP_NAN 0x02 |
| 52 | #define FP_NORMAL 0x04 |
| 53 | #define FP_SUBNORMAL 0x08 |
| 54 | #define FP_ZERO 0x10 |
| 55 | #define fpclassify(x) \ |
| 56 | __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 57 | |
Elliott Hughes | b662280 | 2015-08-14 14:04:30 -0700 | [diff] [blame] | 58 | #define isfinite(x) __builtin_isfinite(x) |
| 59 | #define isinf(x) __builtin_isinf(x) |
| 60 | #define isnan(x) __builtin_isnan(x) |
| 61 | #define isnormal(x) __builtin_isnormal(x) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 62 | |
Elliott Hughes | b662280 | 2015-08-14 14:04:30 -0700 | [diff] [blame] | 63 | #define isgreater(x, y) __builtin_isgreater((x), (y)) |
| 64 | #define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y)) |
| 65 | #define isless(x, y) __builtin_isless((x), (y)) |
| 66 | #define islessequal(x, y) __builtin_islessequal((x), (y)) |
| 67 | #define islessgreater(x, y) __builtin_islessgreater((x), (y)) |
| 68 | #define isunordered(x, y) __builtin_isunordered((x), (y)) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 69 | |
Elliott Hughes | b662280 | 2015-08-14 14:04:30 -0700 | [diff] [blame] | 70 | #define signbit(x) \ |
| 71 | ((sizeof(x) == sizeof(float)) ? __builtin_signbitf(x) \ |
| 72 | : (sizeof(x) == sizeof(double)) ? __builtin_signbit(x) \ |
| 73 | : __builtin_signbitl(x)) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 74 | |
Elliott Hughes | 9f87a0b | 2014-02-07 14:55:58 -0800 | [diff] [blame] | 75 | typedef double __double_t; |
| 76 | typedef __double_t double_t; |
| 77 | typedef float __float_t; |
| 78 | typedef __float_t float_t; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 79 | |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 80 | #if defined(__USE_BSD) |
| 81 | #define HUGE MAXFLOAT |
Elliott Hughes | 9ee6adb | 2016-03-11 14:49:13 -0800 | [diff] [blame] | 82 | #endif |
| 83 | |
Elliott Hughes | c1929e4 | 2016-08-12 16:18:03 -0700 | [diff] [blame] | 84 | extern int signgam; |
| 85 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 86 | /* |
| 87 | * Most of these functions depend on the rounding mode and have the side |
| 88 | * effect of raising floating-point exceptions, so they are not declared |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 89 | * as __attribute_const__. In C99, FENV_ACCESS affects the purity of these functions. |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 90 | */ |
Elliott Hughes | de9ac71 | 2014-05-19 16:58:52 -0700 | [diff] [blame] | 91 | |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 92 | int __fpclassifyd(double) __attribute_const__; |
| 93 | int __fpclassifyf(float) __attribute_const__; |
| 94 | int __fpclassifyl(long double) __attribute_const__; |
| 95 | int __isfinitef(float) __attribute_const__; |
| 96 | int __isfinite(double) __attribute_const__; |
| 97 | int __isfinitel(long double) __attribute_const__; |
| 98 | int __isinff(float) __attribute_const__; |
| 99 | int __isinfl(long double) __attribute_const__; |
| 100 | int __isnanf(float) __attribute_const__ __INTRODUCED_IN(21); |
| 101 | int __isnanl(long double) __attribute_const__; |
| 102 | int __isnormalf(float) __attribute_const__; |
| 103 | int __isnormal(double) __attribute_const__; |
| 104 | int __isnormall(long double) __attribute_const__; |
| 105 | int __signbit(double) __attribute_const__; |
| 106 | int __signbitf(float) __attribute_const__; |
| 107 | int __signbitl(long double) __attribute_const__; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 108 | |
| 109 | double acos(double); |
| 110 | double asin(double); |
| 111 | double atan(double); |
| 112 | double atan2(double, double); |
| 113 | double cos(double); |
| 114 | double sin(double); |
| 115 | double tan(double); |
| 116 | |
| 117 | double cosh(double); |
| 118 | double sinh(double); |
| 119 | double tanh(double); |
| 120 | |
| 121 | double exp(double); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 122 | double frexp(double, int *); /* fundamentally !__attribute_const__ */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 123 | double ldexp(double, int); |
| 124 | double log(double); |
| 125 | double log10(double); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 126 | double modf(double, double *); /* fundamentally !__attribute_const__ */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 127 | |
| 128 | double pow(double, double); |
| 129 | double sqrt(double); |
| 130 | |
| 131 | double ceil(double); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 132 | double fabs(double) __attribute_const__; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 133 | double floor(double); |
| 134 | double fmod(double, double); |
| 135 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 136 | double acosh(double); |
| 137 | double asinh(double); |
| 138 | double atanh(double); |
| 139 | double cbrt(double); |
| 140 | double erf(double); |
| 141 | double erfc(double); |
| 142 | double exp2(double); |
| 143 | double expm1(double); |
| 144 | double fma(double, double, double); |
| 145 | double hypot(double, double); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 146 | int ilogb(double) __attribute_const__; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 147 | double lgamma(double); |
| 148 | long long llrint(double); |
| 149 | long long llround(double); |
| 150 | double log1p(double); |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 151 | double log2(double) __INTRODUCED_IN(18); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 152 | double logb(double); |
| 153 | long lrint(double); |
| 154 | long lround(double); |
Josh Gao | 46b4416 | 2016-05-27 11:14:16 -0700 | [diff] [blame] | 155 | |
Dan Albert | 284c8f1 | 2017-03-30 16:34:27 -0700 | [diff] [blame^] | 156 | /* |
| 157 | * https://code.google.com/p/android/issues/detail?id=271629 |
| 158 | * To be fully compliant with C++, we need to not define these (C doesn't |
| 159 | * specify them either). Exposing these means that isinf and isnan will have a |
| 160 | * return type of int in C++ rather than bool like they're supposed to be. |
| 161 | * |
| 162 | * GNU libstdc++ 4.9 isn't able to handle a standard compliant C library. Its |
| 163 | * <cmath> will `#undef isnan` from math.h and only adds the function overloads |
| 164 | * to the std namespace, making it impossible to use both <cmath> (which gets |
| 165 | * included by a lot of other standard headers) and ::isnan. |
| 166 | */ |
| 167 | int(isinf)(double) __attribute_const__ __INTRODUCED_IN(21); |
| 168 | int (isnan)(double) __attribute_const__; |
| 169 | |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 170 | double nan(const char*) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) |
Josh Gao | 46b4416 | 2016-05-27 11:14:16 -0700 | [diff] [blame] | 171 | __INTRODUCED_IN_X86(9); |
| 172 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 173 | double nextafter(double, double); |
| 174 | double remainder(double, double); |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 175 | double remquo(double, double, int*); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 176 | double rint(double); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 177 | |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 178 | double copysign(double, double) __attribute_const__; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 179 | double fdim(double, double); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 180 | double fmax(double, double) __attribute_const__; |
| 181 | double fmin(double, double) __attribute_const__; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 182 | double nearbyint(double); |
| 183 | double round(double); |
Dan Albert | 31d7037 | 2016-09-13 14:15:21 -0700 | [diff] [blame] | 184 | double scalbln(double, long) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD; |
Josh Gao | 46b4416 | 2016-05-27 11:14:16 -0700 | [diff] [blame] | 185 | double scalbn(double, int); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 186 | double tgamma(double); |
| 187 | double trunc(double); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 188 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 189 | float acosf(float); |
| 190 | float asinf(float); |
| 191 | float atanf(float); |
| 192 | float atan2f(float, float); |
| 193 | float cosf(float); |
| 194 | float sinf(float); |
| 195 | float tanf(float); |
| 196 | |
| 197 | float coshf(float); |
| 198 | float sinhf(float); |
| 199 | float tanhf(float); |
| 200 | |
| 201 | float exp2f(float); |
| 202 | float expf(float); |
| 203 | float expm1f(float); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 204 | float frexpf(float, int *); /* fundamentally !__attribute_const__ */ |
| 205 | int ilogbf(float) __attribute_const__; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 206 | float ldexpf(float, int); |
| 207 | float log10f(float); |
| 208 | float log1pf(float); |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 209 | float log2f(float) __INTRODUCED_IN(18); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 210 | float logf(float); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 211 | float modff(float, float *); /* fundamentally !__attribute_const__ */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 212 | |
| 213 | float powf(float, float); |
| 214 | float sqrtf(float); |
| 215 | |
| 216 | float ceilf(float); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 217 | float fabsf(float) __attribute_const__; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 218 | float floorf(float); |
| 219 | float fmodf(float, float); |
| 220 | float roundf(float); |
| 221 | |
| 222 | float erff(float); |
| 223 | float erfcf(float); |
| 224 | float hypotf(float, float); |
| 225 | float lgammaf(float); |
Josh Gao | 46b4416 | 2016-05-27 11:14:16 -0700 | [diff] [blame] | 226 | float tgammaf(float) __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 227 | |
| 228 | float acoshf(float); |
| 229 | float asinhf(float); |
| 230 | float atanhf(float); |
| 231 | float cbrtf(float); |
| 232 | float logbf(float); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 233 | float copysignf(float, float) __attribute_const__; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 234 | long long llrintf(float); |
| 235 | long long llroundf(float); |
| 236 | long lrintf(float); |
| 237 | long lroundf(float); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 238 | float nanf(const char*) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) |
Josh Gao | 46b4416 | 2016-05-27 11:14:16 -0700 | [diff] [blame] | 239 | __INTRODUCED_IN_X86(9); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 240 | float nearbyintf(float); |
| 241 | float nextafterf(float, float); |
| 242 | float remainderf(float, float); |
| 243 | float remquof(float, float, int *); |
| 244 | float rintf(float); |
Dan Albert | 31d7037 | 2016-09-13 14:15:21 -0700 | [diff] [blame] | 245 | float scalblnf(float, long) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD; |
Josh Gao | 46b4416 | 2016-05-27 11:14:16 -0700 | [diff] [blame] | 246 | float scalbnf(float, int); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 247 | float truncf(float); |
| 248 | |
| 249 | float fdimf(float, float); |
| 250 | float fmaf(float, float, float); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 251 | float fmaxf(float, float) __attribute_const__; |
| 252 | float fminf(float, float) __attribute_const__; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 253 | |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 254 | long double acoshl(long double) __INTRODUCED_IN(21); |
| 255 | long double acosl(long double) __INTRODUCED_IN(21); |
| 256 | long double asinhl(long double) __INTRODUCED_IN(21); |
| 257 | long double asinl(long double) __INTRODUCED_IN(21); |
| 258 | long double atan2l(long double, long double) __INTRODUCED_IN(21); |
| 259 | long double atanhl(long double) __INTRODUCED_IN(21); |
| 260 | long double atanl(long double) __INTRODUCED_IN(21); |
| 261 | long double cbrtl(long double) __INTRODUCED_IN(21); |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 262 | long double ceill(long double); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 263 | long double copysignl(long double, long double) __attribute_const__; |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 264 | long double coshl(long double) __INTRODUCED_IN(21); |
| 265 | long double cosl(long double) __INTRODUCED_IN(21); |
| 266 | long double erfcl(long double) __INTRODUCED_IN(21); |
| 267 | long double erfl(long double) __INTRODUCED_IN(21); |
| 268 | long double exp2l(long double) __INTRODUCED_IN(21); |
| 269 | long double expl(long double) __INTRODUCED_IN(21); |
| 270 | long double expm1l(long double) __INTRODUCED_IN(21); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 271 | long double fabsl(long double) __attribute_const__; |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 272 | long double fdiml(long double, long double); |
| 273 | long double floorl(long double); |
Dan Albert | cb0b143 | 2016-09-06 16:51:00 -0700 | [diff] [blame] | 274 | long double fmal(long double, long double, long double) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD; |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 275 | long double fmaxl(long double, long double) __attribute_const__; |
| 276 | long double fminl(long double, long double) __attribute_const__; |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 277 | long double fmodl(long double, long double) __INTRODUCED_IN(21); |
Dan Albert | cb0b143 | 2016-09-06 16:51:00 -0700 | [diff] [blame] | 278 | long double frexpl(long double value, int*) |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 279 | __INTRODUCED_IN(21) __VERSIONER_NO_GUARD; /* fundamentally !__attribute_const__ */ |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 280 | long double hypotl(long double, long double) __INTRODUCED_IN(21); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 281 | int ilogbl(long double) __attribute_const__; |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 282 | long double ldexpl(long double, int); |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 283 | long double lgammal(long double) __INTRODUCED_IN(21); |
| 284 | long long llrintl(long double) __INTRODUCED_IN(21); |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 285 | long long llroundl(long double); |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 286 | long double log10l(long double) __INTRODUCED_IN(21); |
| 287 | long double log1pl(long double) __INTRODUCED_IN(21); |
| 288 | long double log2l(long double) __INTRODUCED_IN(18); |
| 289 | long double logbl(long double) __INTRODUCED_IN(18); |
| 290 | long double logl(long double) __INTRODUCED_IN(21); |
| 291 | long lrintl(long double) __INTRODUCED_IN(21); |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 292 | long lroundl(long double); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 293 | long double modfl(long double, long double*) __INTRODUCED_IN(21); /* fundamentally !__attribute_const__ */ |
| 294 | long double nanl(const char*) __attribute_const__ __INTRODUCED_IN(13); |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 295 | long double nearbyintl(long double) __INTRODUCED_IN(21); |
Dan Albert | cb0b143 | 2016-09-06 16:51:00 -0700 | [diff] [blame] | 296 | long double nextafterl(long double, long double) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD; |
| 297 | double nexttoward(double, long double) __INTRODUCED_IN(18) __VERSIONER_NO_GUARD; |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 298 | float nexttowardf(float, long double); |
Dan Albert | cb0b143 | 2016-09-06 16:51:00 -0700 | [diff] [blame] | 299 | long double nexttowardl(long double, long double) __INTRODUCED_IN(18) __VERSIONER_NO_GUARD; |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 300 | long double powl(long double, long double) __INTRODUCED_IN(21); |
| 301 | long double remainderl(long double, long double) __INTRODUCED_IN(21); |
| 302 | long double remquol(long double, long double, int*) __INTRODUCED_IN(21); |
| 303 | long double rintl(long double) __INTRODUCED_IN(21); |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 304 | long double roundl(long double); |
Dan Albert | 31d7037 | 2016-09-13 14:15:21 -0700 | [diff] [blame] | 305 | long double scalblnl(long double, long) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD; |
Josh Gao | 46b4416 | 2016-05-27 11:14:16 -0700 | [diff] [blame] | 306 | long double scalbnl(long double, int); |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 307 | long double sinhl(long double) __INTRODUCED_IN(21); |
| 308 | long double sinl(long double) __INTRODUCED_IN(21); |
| 309 | long double sqrtl(long double) __INTRODUCED_IN(21); |
| 310 | long double tanhl(long double) __INTRODUCED_IN(21); |
| 311 | long double tanl(long double) __INTRODUCED_IN(21); |
| 312 | long double tgammal(long double) __INTRODUCED_IN(21); |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 313 | long double truncl(long double); |
Elliott Hughes | b4f2f28 | 2014-05-08 21:19:12 -0700 | [diff] [blame] | 314 | |
Elliott Hughes | c1929e4 | 2016-08-12 16:18:03 -0700 | [diff] [blame] | 315 | double j0(double); |
| 316 | double j1(double); |
| 317 | double jn(int, double); |
| 318 | double y0(double); |
| 319 | double y1(double); |
| 320 | double yn(int, double); |
| 321 | |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 322 | #define M_E 2.7182818284590452354 /* e */ |
| 323 | #define M_LOG2E 1.4426950408889634074 /* log 2e */ |
| 324 | #define M_LOG10E 0.43429448190325182765 /* log 10e */ |
| 325 | #define M_LN2 0.69314718055994530942 /* log e2 */ |
| 326 | #define M_LN10 2.30258509299404568402 /* log e10 */ |
| 327 | #define M_PI 3.14159265358979323846 /* pi */ |
| 328 | #define M_PI_2 1.57079632679489661923 /* pi/2 */ |
| 329 | #define M_PI_4 0.78539816339744830962 /* pi/4 */ |
| 330 | #define M_1_PI 0.31830988618379067154 /* 1/pi */ |
| 331 | #define M_2_PI 0.63661977236758134308 /* 2/pi */ |
| 332 | #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ |
| 333 | #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ |
| 334 | #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ |
Elliott Hughes | 9c8d711 | 2016-06-13 13:23:42 -0700 | [diff] [blame] | 335 | |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 336 | #define MAXFLOAT ((float)3.40282346638528860e+38) |
Elliott Hughes | 9c8d711 | 2016-06-13 13:23:42 -0700 | [diff] [blame] | 337 | |
| 338 | #if defined(__USE_BSD) || defined(__USE_GNU) |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 339 | double gamma(double); |
| 340 | double scalb(double, double); |
| 341 | double drem(double, double); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 342 | int finite(double) __attribute_const__; |
| 343 | int isnanf(float) __attribute_const__; |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 344 | double gamma_r(double, int*); |
| 345 | double lgamma_r(double, int*); |
| 346 | double significand(double); |
Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 347 | long double lgammal_r(long double, int*) __INTRODUCED_IN(23); |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 348 | long double significandl(long double) __INTRODUCED_IN(21); |
| 349 | float dremf(float, float); |
Elliott Hughes | 95fa061 | 2016-09-28 12:29:52 -0700 | [diff] [blame] | 350 | int finitef(float) __attribute_const__; |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 351 | float gammaf(float); |
| 352 | float j0f(float); |
| 353 | float j1f(float); |
| 354 | float jnf(int, float); |
| 355 | float scalbf(float, float); |
| 356 | float y0f(float); |
| 357 | float y1f(float); |
| 358 | float ynf(int, float); |
| 359 | float gammaf_r(float, int *); |
| 360 | float lgammaf_r(float, int *); |
| 361 | float significandf(float); |
Elliott Hughes | 7553185 | 2014-09-18 11:23:58 -0700 | [diff] [blame] | 362 | #endif |
| 363 | |
Elliott Hughes | 5f5cc45 | 2014-08-18 16:04:03 -0700 | [diff] [blame] | 364 | #if defined(__USE_GNU) |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 365 | #define M_El 2.718281828459045235360287471352662498L /* e */ |
| 366 | #define M_LOG2El 1.442695040888963407359924681001892137L /* log 2e */ |
| 367 | #define M_LOG10El 0.434294481903251827651128918916605082L /* log 10e */ |
| 368 | #define M_LN2l 0.693147180559945309417232121458176568L /* log e2 */ |
| 369 | #define M_LN10l 2.302585092994045684017991454684364208L /* log e10 */ |
| 370 | #define M_PIl 3.141592653589793238462643383279502884L /* pi */ |
| 371 | #define M_PI_2l 1.570796326794896619231321691639751442L /* pi/2 */ |
| 372 | #define M_PI_4l 0.785398163397448309615660845819875721L /* pi/4 */ |
| 373 | #define M_1_PIl 0.318309886183790671537767526745028724L /* 1/pi */ |
| 374 | #define M_2_PIl 0.636619772367581343075535053490057448L /* 2/pi */ |
| 375 | #define M_2_SQRTPIl 1.128379167095512573896158903121545172L /* 2/sqrt(pi) */ |
| 376 | #define M_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */ |
| 377 | #define M_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */ |
Elliott Hughes | b4f2f28 | 2014-05-08 21:19:12 -0700 | [diff] [blame] | 378 | void sincos(double, double*, double*); |
| 379 | void sincosf(float, float*, float*); |
| 380 | void sincosl(long double, long double*, long double*); |
Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 381 | #endif |
Elliott Hughes | b4f2f28 | 2014-05-08 21:19:12 -0700 | [diff] [blame] | 382 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 383 | __END_DECLS |
| 384 | |
| 385 | #endif /* !_MATH_H_ */ |