Home | History | Annotate | Download | only in include
      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
     14  * $FreeBSD$
     15  */
     16 
     17 #ifndef _MATH_H_
     18 #define	_MATH_H_
     19 
     20 #include <sys/cdefs.h>
     21 #include <limits.h>
     22 
     23 __BEGIN_DECLS
     24 #pragma GCC visibility push(default)
     25 
     26 /*
     27  * ANSI/POSIX
     28  */
     29 extern const union __infinity_un {
     30 	unsigned char	__uc[8];
     31 	double		__ud;
     32 } __infinity;
     33 
     34 extern const union __nan_un {
     35 	unsigned char	__uc[sizeof(float)];
     36 	float		__uf;
     37 } __nan;
     38 
     39 #if __GNUC_PREREQ(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
     40 #define	__MATH_BUILTIN_CONSTANTS
     41 #endif
     42 
     43 #if __GNUC_PREREQ(3, 0) && !defined(__INTEL_COMPILER)
     44 #define	__MATH_BUILTIN_RELOPS
     45 #endif
     46 
     47 #ifdef __MATH_BUILTIN_CONSTANTS
     48 #define	HUGE_VAL	__builtin_huge_val()
     49 #else
     50 #define	HUGE_VAL	(__infinity.__ud)
     51 #endif
     52 
     53 #if __ISO_C_VISIBLE >= 1999
     54 #define	FP_ILOGB0	(-INT_MAX) /* Android-changed */
     55 #define	FP_ILOGBNAN	INT_MAX /* Android-changed */
     56 
     57 #ifdef __MATH_BUILTIN_CONSTANTS
     58 #define	HUGE_VALF	__builtin_huge_valf()
     59 #define	HUGE_VALL	__builtin_huge_vall()
     60 #define	INFINITY	__builtin_inff()
     61 #define	NAN		__builtin_nanf("")
     62 #else
     63 #define	HUGE_VALF	(float)HUGE_VAL
     64 #define	HUGE_VALL	(long double)HUGE_VAL
     65 #define	INFINITY	HUGE_VALF
     66 #define	NAN		(__nan.__uf)
     67 #endif /* __MATH_BUILTIN_CONSTANTS */
     68 
     69 #define	MATH_ERRNO	1
     70 #define	MATH_ERREXCEPT	2
     71 #define	math_errhandling	MATH_ERREXCEPT
     72 
     73 #define	FP_FAST_FMAF	1
     74 #ifdef __ia64__
     75 #define	FP_FAST_FMA	1
     76 #define	FP_FAST_FMAL	1
     77 #endif
     78 
     79 /* Symbolic constants to classify floating point numbers. */
     80 #define	FP_INFINITE	0x01
     81 #define	FP_NAN		0x02
     82 #define	FP_NORMAL	0x04
     83 #define	FP_SUBNORMAL	0x08
     84 #define	FP_ZERO		0x10
     85 #define	fpclassify(x) \
     86     ((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) \
     87     : (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) \
     88     : __fpclassifyl(x))
     89 
     90 #define	isfinite(x)					\
     91     ((sizeof (x) == sizeof (float)) ? __isfinitef(x)	\
     92     : (sizeof (x) == sizeof (double)) ? __isfinite(x)	\
     93     : __isfinitel(x))
     94 #define	isinf(x)					\
     95     ((sizeof (x) == sizeof (float)) ? __isinff(x)	\
     96     : (sizeof (x) == sizeof (double)) ? isinf(x)	\
     97     : __isinfl(x))
     98 #define	isnan(x)					\
     99     ((sizeof (x) == sizeof (float)) ? __isnanf(x)	\
    100     : (sizeof (x) == sizeof (double)) ? isnan(x)	\
    101     : __isnanl(x))
    102 #define	isnormal(x)					\
    103     ((sizeof (x) == sizeof (float)) ? __isnormalf(x)	\
    104     : (sizeof (x) == sizeof (double)) ? __isnormal(x)	\
    105     : __isnormall(x))
    106 
    107 #ifdef __MATH_BUILTIN_RELOPS
    108 #define	isgreater(x, y)		__builtin_isgreater((x), (y))
    109 #define	isgreaterequal(x, y)	__builtin_isgreaterequal((x), (y))
    110 #define	isless(x, y)		__builtin_isless((x), (y))
    111 #define	islessequal(x, y)	__builtin_islessequal((x), (y))
    112 #define	islessgreater(x, y)	__builtin_islessgreater((x), (y))
    113 #define	isunordered(x, y)	__builtin_isunordered((x), (y))
    114 #else
    115 #define	isgreater(x, y)		(!isunordered((x), (y)) && (x) > (y))
    116 #define	isgreaterequal(x, y)	(!isunordered((x), (y)) && (x) >= (y))
    117 #define	isless(x, y)		(!isunordered((x), (y)) && (x) < (y))
    118 #define	islessequal(x, y)	(!isunordered((x), (y)) && (x) <= (y))
    119 #define	islessgreater(x, y)	(!isunordered((x), (y)) && \
    120 					((x) > (y) || (y) > (x)))
    121 #define	isunordered(x, y)	(isnan(x) || isnan(y))
    122 #endif /* __MATH_BUILTIN_RELOPS */
    123 
    124 #define	signbit(x)					\
    125     ((sizeof (x) == sizeof (float)) ? __signbitf(x)	\
    126     : (sizeof (x) == sizeof (double)) ? __signbit(x)	\
    127     : __signbitl(x))
    128 
    129 typedef double __double_t;
    130 typedef __double_t double_t;
    131 typedef float __float_t;
    132 typedef __float_t float_t;
    133 #endif /* __ISO_C_VISIBLE >= 1999 */
    134 
    135 /*
    136  * XOPEN/SVID
    137  */
    138 #if __BSD_VISIBLE || __XSI_VISIBLE
    139 #define	M_E		2.7182818284590452354	/* e */
    140 #define	M_LOG2E		1.4426950408889634074	/* log 2e */
    141 #define	M_LOG10E	0.43429448190325182765	/* log 10e */
    142 #define	M_LN2		0.69314718055994530942	/* log e2 */
    143 #define	M_LN10		2.30258509299404568402	/* log e10 */
    144 #define	M_PI		3.14159265358979323846	/* pi */
    145 #define	M_PI_2		1.57079632679489661923	/* pi/2 */
    146 #define	M_PI_4		0.78539816339744830962	/* pi/4 */
    147 #define	M_1_PI		0.31830988618379067154	/* 1/pi */
    148 #define	M_2_PI		0.63661977236758134308	/* 2/pi */
    149 #define	M_2_SQRTPI	1.12837916709551257390	/* 2/sqrt(pi) */
    150 #define	M_SQRT2		1.41421356237309504880	/* sqrt(2) */
    151 #define	M_SQRT1_2	0.70710678118654752440	/* 1/sqrt(2) */
    152 
    153 #define	MAXFLOAT	((float)3.40282346638528860e+38)
    154 extern int signgam;
    155 #endif /* __BSD_VISIBLE || __XSI_VISIBLE */
    156 
    157 #if __BSD_VISIBLE
    158 #if 0
    159 /* Old value from 4.4BSD-Lite math.h; this is probably better. */
    160 #define	HUGE		HUGE_VAL
    161 #else
    162 #define	HUGE		MAXFLOAT
    163 #endif
    164 #endif /* __BSD_VISIBLE */
    165 
    166 /*
    167  * Most of these functions depend on the rounding mode and have the side
    168  * effect of raising floating-point exceptions, so they are not declared
    169  * as __pure2.  In C99, FENV_ACCESS affects the purity of these functions.
    170  */
    171 
    172 /*
    173  * ANSI/POSIX
    174  */
    175 int	__fpclassifyd(double) __NDK_FPABI_MATH__  __pure2;
    176 int	__fpclassifyf(float) __NDK_FPABI_MATH__  __pure2;
    177 int	__fpclassifyl(long double) __NDK_FPABI_MATH__  __pure2;
    178 int	__isfinitef(float) __NDK_FPABI_MATH__  __pure2;
    179 int	__isfinite(double) __NDK_FPABI_MATH__  __pure2;
    180 int	__isfinitel(long double) __NDK_FPABI_MATH__  __pure2;
    181 int	__isinff(float) __NDK_FPABI_MATH__  __pure2;
    182 int	__isinfl(long double) __NDK_FPABI_MATH__  __pure2;
    183 int	__isnanf(float) __NDK_FPABI_MATH__  __pure2;
    184 int	__isnanl(long double) __NDK_FPABI_MATH__  __pure2;
    185 int	__isnormalf(float) __NDK_FPABI_MATH__  __pure2;
    186 int	__isnormal(double) __NDK_FPABI_MATH__  __pure2;
    187 int	__isnormall(long double) __NDK_FPABI_MATH__  __pure2;
    188 int	__signbit(double) __NDK_FPABI_MATH__  __pure2;
    189 int	__signbitf(float) __NDK_FPABI_MATH__  __pure2;
    190 int	__signbitl(long double) __NDK_FPABI_MATH__  __pure2;
    191 
    192 double	acos(double) __NDK_FPABI_MATH__;
    193 double	asin(double) __NDK_FPABI_MATH__;
    194 double	atan(double) __NDK_FPABI_MATH__;
    195 double	atan2(double, double) __NDK_FPABI_MATH__;
    196 double	cos(double) __NDK_FPABI_MATH__;
    197 double	sin(double) __NDK_FPABI_MATH__;
    198 double	tan(double) __NDK_FPABI_MATH__;
    199 
    200 double	cosh(double) __NDK_FPABI_MATH__;
    201 double	sinh(double) __NDK_FPABI_MATH__;
    202 double	tanh(double) __NDK_FPABI_MATH__;
    203 
    204 double	exp(double) __NDK_FPABI_MATH__;
    205 double	frexp(double, int *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
    206 double	ldexp(double, int) __NDK_FPABI_MATH__;
    207 double	log(double) __NDK_FPABI_MATH__;
    208 double	log10(double) __NDK_FPABI_MATH__;
    209 double	modf(double, double *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
    210 
    211 double	pow(double, double) __NDK_FPABI_MATH__;
    212 double	sqrt(double) __NDK_FPABI_MATH__;
    213 
    214 double	ceil(double) __NDK_FPABI_MATH__;
    215 double	fabs(double) __NDK_FPABI_MATH__ __pure2;
    216 double	floor(double) __NDK_FPABI_MATH__;
    217 double	fmod(double, double) __NDK_FPABI_MATH__;
    218 
    219 /*
    220  * These functions are not in C90.
    221  */
    222 #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE
    223 double	acosh(double) __NDK_FPABI_MATH__;
    224 double	asinh(double) __NDK_FPABI_MATH__;
    225 double	atanh(double) __NDK_FPABI_MATH__;
    226 double	cbrt(double) __NDK_FPABI_MATH__;
    227 double	erf(double) __NDK_FPABI_MATH__;
    228 double	erfc(double) __NDK_FPABI_MATH__;
    229 double	exp2(double) __NDK_FPABI_MATH__;
    230 double	expm1(double) __NDK_FPABI_MATH__;
    231 double	fma(double, double, double) __NDK_FPABI_MATH__;
    232 double	hypot(double, double) __NDK_FPABI_MATH__;
    233 int	ilogb(double) __NDK_FPABI_MATH__ __pure2;
    234 int	(isinf)(double) __NDK_FPABI_MATH__ __pure2;
    235 int	(isnan)(double) __NDK_FPABI_MATH__ __pure2;
    236 double	lgamma(double) __NDK_FPABI_MATH__;
    237 long long llrint(double) __NDK_FPABI_MATH__;
    238 long long llround(double) __NDK_FPABI_MATH__;
    239 double	log1p(double) __NDK_FPABI_MATH__;
    240 double	log2(double) __NDK_FPABI_MATH__;
    241 double	logb(double) __NDK_FPABI_MATH__;
    242 long	lrint(double) __NDK_FPABI_MATH__;
    243 long	lround(double) __NDK_FPABI_MATH__;
    244 double	nan(const char *) __NDK_FPABI_MATH__ __pure2;
    245 double	nextafter(double, double) __NDK_FPABI_MATH__;
    246 double	remainder(double, double) __NDK_FPABI_MATH__;
    247 double	remquo(double, double, int *) __NDK_FPABI_MATH__;
    248 double	rint(double) __NDK_FPABI_MATH__;
    249 #endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
    250 
    251 #if __BSD_VISIBLE || __XSI_VISIBLE
    252 double	j0(double) __NDK_FPABI_MATH__;
    253 double	j1(double) __NDK_FPABI_MATH__;
    254 double	jn(int, double) __NDK_FPABI_MATH__;
    255 double	y0(double) __NDK_FPABI_MATH__;
    256 double	y1(double) __NDK_FPABI_MATH__;
    257 double	yn(int, double) __NDK_FPABI_MATH__;
    258 
    259 #if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
    260 double	gamma(double) __NDK_FPABI_MATH__;
    261 #endif
    262 
    263 #if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
    264 double	scalb(double, double) __NDK_FPABI_MATH__;
    265 #endif
    266 #endif /* __BSD_VISIBLE || __XSI_VISIBLE */
    267 
    268 #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
    269 double	copysign(double, double) __NDK_FPABI_MATH__ __pure2;
    270 double	fdim(double, double) __NDK_FPABI_MATH__;
    271 double	fmax(double, double) __NDK_FPABI_MATH__ __pure2;
    272 double	fmin(double, double) __NDK_FPABI_MATH__ __pure2;
    273 double	nearbyint(double) __NDK_FPABI_MATH__;
    274 double	round(double) __NDK_FPABI_MATH__;
    275 double	scalbln(double, long) __NDK_FPABI_MATH__;
    276 double	scalbn(double, int) __NDK_FPABI_MATH__;
    277 double	tgamma(double) __NDK_FPABI_MATH__;
    278 double	trunc(double) __NDK_FPABI_MATH__;
    279 #endif
    280 
    281 /*
    282  * BSD math library entry points
    283  */
    284 #if __BSD_VISIBLE
    285 double	drem(double, double) __NDK_FPABI_MATH__;
    286 int	finite(double) __NDK_FPABI_MATH__ __pure2;
    287 int	isnanf(float) __NDK_FPABI_MATH__ __pure2;
    288 long double significandl(long double) __NDK_FPABI_MATH__;
    289 
    290 /*
    291  * Reentrant version of gamma & lgamma; passes signgam back by reference
    292  * as the second argument; user must allocate space for signgam.
    293  */
    294 double	gamma_r(double, int *) __NDK_FPABI_MATH__;
    295 double	lgamma_r(double, int *) __NDK_FPABI_MATH__;
    296 
    297 /*
    298  * IEEE Test Vector
    299  */
    300 double	significand(double) __NDK_FPABI_MATH__;
    301 #endif /* __BSD_VISIBLE */
    302 
    303 /* float versions of ANSI/POSIX functions */
    304 #if __ISO_C_VISIBLE >= 1999
    305 float	acosf(float) __NDK_FPABI_MATH__;
    306 float	asinf(float) __NDK_FPABI_MATH__;
    307 float	atanf(float) __NDK_FPABI_MATH__;
    308 float	atan2f(float, float) __NDK_FPABI_MATH__;
    309 float	cosf(float) __NDK_FPABI_MATH__;
    310 float	sinf(float) __NDK_FPABI_MATH__;
    311 float	tanf(float) __NDK_FPABI_MATH__;
    312 
    313 float	coshf(float) __NDK_FPABI_MATH__;
    314 float	sinhf(float) __NDK_FPABI_MATH__;
    315 float	tanhf(float) __NDK_FPABI_MATH__;
    316 
    317 float	exp2f(float) __NDK_FPABI_MATH__;
    318 float	expf(float) __NDK_FPABI_MATH__;
    319 float	expm1f(float) __NDK_FPABI_MATH__;
    320 float	frexpf(float, int *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
    321 int	ilogbf(float) __NDK_FPABI_MATH__ __pure2;
    322 float	ldexpf(float, int) __NDK_FPABI_MATH__;
    323 float	log10f(float) __NDK_FPABI_MATH__;
    324 float	log1pf(float) __NDK_FPABI_MATH__;
    325 float	log2f(float) __NDK_FPABI_MATH__;
    326 float	logf(float) __NDK_FPABI_MATH__;
    327 float	modff(float, float *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
    328 
    329 float	powf(float, float) __NDK_FPABI_MATH__;
    330 float	sqrtf(float) __NDK_FPABI_MATH__;
    331 
    332 float	ceilf(float) __NDK_FPABI_MATH__;
    333 float	fabsf(float) __NDK_FPABI_MATH__ __pure2;
    334 float	floorf(float) __NDK_FPABI_MATH__;
    335 float	fmodf(float, float) __NDK_FPABI_MATH__;
    336 float	roundf(float) __NDK_FPABI_MATH__;
    337 
    338 float	erff(float) __NDK_FPABI_MATH__;
    339 float	erfcf(float) __NDK_FPABI_MATH__;
    340 float	hypotf(float, float) __NDK_FPABI_MATH__;
    341 float	lgammaf(float) __NDK_FPABI_MATH__;
    342 float	tgammaf(float) __NDK_FPABI_MATH__;
    343 
    344 float	acoshf(float) __NDK_FPABI_MATH__;
    345 float	asinhf(float) __NDK_FPABI_MATH__;
    346 float	atanhf(float) __NDK_FPABI_MATH__;
    347 float	cbrtf(float) __NDK_FPABI_MATH__;
    348 float	logbf(float) __NDK_FPABI_MATH__;
    349 float	copysignf(float, float) __NDK_FPABI_MATH__ __pure2;
    350 long long llrintf(float) __NDK_FPABI_MATH__;
    351 long long llroundf(float) __NDK_FPABI_MATH__;
    352 long	lrintf(float) __NDK_FPABI_MATH__;
    353 long	lroundf(float) __NDK_FPABI_MATH__;
    354 float	nanf(const char *) __NDK_FPABI_MATH__ __pure2;
    355 float	nearbyintf(float) __NDK_FPABI_MATH__;
    356 float	nextafterf(float, float) __NDK_FPABI_MATH__;
    357 float	remainderf(float, float) __NDK_FPABI_MATH__;
    358 float	remquof(float, float, int *) __NDK_FPABI_MATH__;
    359 float	rintf(float) __NDK_FPABI_MATH__;
    360 float	scalblnf(float, long) __NDK_FPABI_MATH__;
    361 float	scalbnf(float, int) __NDK_FPABI_MATH__;
    362 float	truncf(float) __NDK_FPABI_MATH__;
    363 
    364 float	fdimf(float, float) __NDK_FPABI_MATH__;
    365 float	fmaf(float, float, float) __NDK_FPABI_MATH__;
    366 float	fmaxf(float, float) __NDK_FPABI_MATH__ __pure2;
    367 float	fminf(float, float) __NDK_FPABI_MATH__ __pure2;
    368 #endif
    369 
    370 /*
    371  * float versions of BSD math library entry points
    372  */
    373 #if __BSD_VISIBLE
    374 float	dremf(float, float) __NDK_FPABI_MATH__;
    375 int	finitef(float) __NDK_FPABI_MATH__ __pure2;
    376 float	gammaf(float) __NDK_FPABI_MATH__;
    377 float	j0f(float) __NDK_FPABI_MATH__;
    378 float	j1f(float) __NDK_FPABI_MATH__;
    379 float	jnf(int, float) __NDK_FPABI_MATH__;
    380 float	scalbf(float, float) __NDK_FPABI_MATH__;
    381 float	y0f(float) __NDK_FPABI_MATH__;
    382 float	y1f(float) __NDK_FPABI_MATH__;
    383 float	ynf(int, float) __NDK_FPABI_MATH__;
    384 
    385 /*
    386  * Float versions of reentrant version of gamma & lgamma; passes
    387  * signgam back by reference as the second argument; user must
    388  * allocate space for signgam.
    389  */
    390 float	gammaf_r(float, int *) __NDK_FPABI_MATH__;
    391 float	lgammaf_r(float, int *) __NDK_FPABI_MATH__;
    392 
    393 /*
    394  * float version of IEEE Test Vector
    395  */
    396 float	significandf(float) __NDK_FPABI_MATH__;
    397 #endif	/* __BSD_VISIBLE */
    398 
    399 /*
    400  * long double versions of ISO/POSIX math functions
    401  */
    402 #if __ISO_C_VISIBLE >= 1999
    403 long double	acoshl(long double) __NDK_FPABI_MATH__;
    404 long double	acosl(long double) __NDK_FPABI_MATH__;
    405 long double	asinhl(long double) __NDK_FPABI_MATH__;
    406 long double	asinl(long double) __NDK_FPABI_MATH__;
    407 long double	atan2l(long double, long double) __NDK_FPABI_MATH__;
    408 long double	atanhl(long double) __NDK_FPABI_MATH__;
    409 long double	atanl(long double) __NDK_FPABI_MATH__;
    410 long double	cbrtl(long double) __NDK_FPABI_MATH__;
    411 long double	ceill(long double) __NDK_FPABI_MATH__;
    412 long double	copysignl(long double, long double) __NDK_FPABI_MATH__ __pure2;
    413 long double	coshl(long double) __NDK_FPABI_MATH__;
    414 long double	cosl(long double) __NDK_FPABI_MATH__;
    415 long double	erfcl(long double) __NDK_FPABI_MATH__;
    416 long double	erfl(long double) __NDK_FPABI_MATH__;
    417 long double	exp2l(long double) __NDK_FPABI_MATH__;
    418 long double	expl(long double) __NDK_FPABI_MATH__;
    419 long double	expm1l(long double) __NDK_FPABI_MATH__;
    420 long double	fabsl(long double) __NDK_FPABI_MATH__ __pure2;
    421 long double	fdiml(long double, long double) __NDK_FPABI_MATH__;
    422 long double	floorl(long double) __NDK_FPABI_MATH__;
    423 long double	fmal(long double, long double, long double) __NDK_FPABI_MATH__;
    424 long double	fmaxl(long double, long double) __NDK_FPABI_MATH__ __pure2;
    425 long double	fminl(long double, long double) __NDK_FPABI_MATH__ __pure2;
    426 long double	fmodl(long double, long double) __NDK_FPABI_MATH__;
    427 long double	frexpl(long double value, int *) __NDK_FPABI_MATH__; /* fundamentally !__pure2 */
    428 long double	hypotl(long double, long double) __NDK_FPABI_MATH__;
    429 int		ilogbl(long double) __NDK_FPABI_MATH__ __pure2;
    430 long double	ldexpl(long double, int) __NDK_FPABI_MATH__;
    431 long double	lgammal(long double) __NDK_FPABI_MATH__;
    432 long long	llrintl(long double) __NDK_FPABI_MATH__;
    433 long long	llroundl(long double) __NDK_FPABI_MATH__;
    434 long double	log10l(long double) __NDK_FPABI_MATH__;
    435 long double	log1pl(long double) __NDK_FPABI_MATH__;
    436 long double	log2l(long double) __NDK_FPABI_MATH__;
    437 long double	logbl(long double) __NDK_FPABI_MATH__;
    438 long double	logl(long double) __NDK_FPABI_MATH__;
    439 long		lrintl(long double) __NDK_FPABI_MATH__;
    440 long		lroundl(long double) __NDK_FPABI_MATH__;
    441 long double	modfl(long double, long double *) __NDK_FPABI_MATH__; /* fundamentally !__pure2 */
    442 long double	nanl(const char *) __NDK_FPABI_MATH__ __pure2;
    443 long double	nearbyintl(long double) __NDK_FPABI_MATH__;
    444 long double	nextafterl(long double, long double) __NDK_FPABI_MATH__;
    445 double		nexttoward(double, long double) __NDK_FPABI_MATH__;
    446 float		nexttowardf(float, long double) __NDK_FPABI_MATH__;
    447 long double	nexttowardl(long double, long double) __NDK_FPABI_MATH__;
    448 long double	powl(long double, long double) __NDK_FPABI_MATH__;
    449 long double	remainderl(long double, long double) __NDK_FPABI_MATH__;
    450 long double	remquol(long double, long double, int *) __NDK_FPABI_MATH__;
    451 long double	rintl(long double) __NDK_FPABI_MATH__;
    452 long double	roundl(long double) __NDK_FPABI_MATH__;
    453 long double	scalblnl(long double, long) __NDK_FPABI_MATH__;
    454 long double	scalbnl(long double, int) __NDK_FPABI_MATH__;
    455 long double	sinhl(long double) __NDK_FPABI_MATH__;
    456 long double	sinl(long double) __NDK_FPABI_MATH__;
    457 long double	sqrtl(long double) __NDK_FPABI_MATH__;
    458 long double	tanhl(long double) __NDK_FPABI_MATH__;
    459 long double	tanl(long double) __NDK_FPABI_MATH__;
    460 long double	tgammal(long double) __NDK_FPABI_MATH__;
    461 long double	truncl(long double) __NDK_FPABI_MATH__;
    462 
    463 #endif /* __ISO_C_VISIBLE >= 1999 */
    464 
    465 #if defined(_GNU_SOURCE)
    466 void sincos(double, double*, double*) __NDK_FPABI_MATH__;
    467 void sincosf(float, float*, float*) __NDK_FPABI_MATH__;
    468 void sincosl(long double, long double*, long double*) __NDK_FPABI_MATH__;
    469 #endif /* _GNU_SOURCE */
    470 
    471 /* builtin version of all the above math functions are annotated too */
    472 
    473 double	__builtin_acos(double) __NDK_FPABI_MATH__;
    474 double	__builtin_asin(double) __NDK_FPABI_MATH__;
    475 double	__builtin_atan(double) __NDK_FPABI_MATH__;
    476 double	__builtin_atan2(double, double) __NDK_FPABI_MATH__;
    477 double	__builtin_cos(double) __NDK_FPABI_MATH__;
    478 double	__builtin_sin(double) __NDK_FPABI_MATH__;
    479 double	__builtin_tan(double) __NDK_FPABI_MATH__;
    480 
    481 double	__builtin_cosh(double) __NDK_FPABI_MATH__;
    482 double	__builtin_sinh(double) __NDK_FPABI_MATH__;
    483 double	__builtin_tanh(double) __NDK_FPABI_MATH__;
    484 
    485 double	__builtin_exp(double) __NDK_FPABI_MATH__;
    486 double	__builtin_frexp(double, int *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
    487 double	__builtin_ldexp(double, int) __NDK_FPABI_MATH__;
    488 double	__builtin_log(double) __NDK_FPABI_MATH__;
    489 double	__builtin_log10(double) __NDK_FPABI_MATH__;
    490 double	__builtin_modf(double, double *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
    491 
    492 double	__builtin_pow(double, double) __NDK_FPABI_MATH__;
    493 double	__builtin_sqrt(double) __NDK_FPABI_MATH__;
    494 
    495 double	__builtin_ceil(double) __NDK_FPABI_MATH__;
    496 double	__builtin_fabs(double) __NDK_FPABI_MATH__ __pure2;
    497 double	__builtin_floor(double) __NDK_FPABI_MATH__;
    498 double	__builtin_fmod(double, double) __NDK_FPABI_MATH__;
    499 
    500 /*
    501  * These functions are not in C90.
    502  */
    503 #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE
    504 double	__builtin_acosh(double) __NDK_FPABI_MATH__;
    505 double	__builtin_asinh(double) __NDK_FPABI_MATH__;
    506 double	__builtin_atanh(double) __NDK_FPABI_MATH__;
    507 double	__builtin_cbrt(double) __NDK_FPABI_MATH__;
    508 double	__builtin_erf(double) __NDK_FPABI_MATH__;
    509 double	__builtin_erfc(double) __NDK_FPABI_MATH__;
    510 double	__builtin_exp2(double) __NDK_FPABI_MATH__;
    511 double	__builtin_expm1(double) __NDK_FPABI_MATH__;
    512 double	__builtin_fma(double, double, double) __NDK_FPABI_MATH__;
    513 double	__builtin_hypot(double, double) __NDK_FPABI_MATH__;
    514 int	__builtin_ilogb(double) __NDK_FPABI_MATH__ __pure2;
    515 #if !defined(__clang__)
    516 /* See upstream bug http://llvm.org/bugs/show_bug.cgi?id=20958 */
    517 int	__builtin_isinf(double) __NDK_FPABI_MATH__ __pure2;
    518 int	__builtin_isnan(double) __NDK_FPABI_MATH__ __pure2;
    519 #endif
    520 double	__builtin_lgamma(double) __NDK_FPABI_MATH__;
    521 long long __builtin_llrint(double) __NDK_FPABI_MATH__;
    522 long long __builtin_llround(double) __NDK_FPABI_MATH__;
    523 double	__builtin_log1p(double) __NDK_FPABI_MATH__;
    524 double	__builtin_log2(double) __NDK_FPABI_MATH__;
    525 double	__builtin_logb(double) __NDK_FPABI_MATH__;
    526 long	__builtin_lrint(double) __NDK_FPABI_MATH__;
    527 long	__builtin_lround(double) __NDK_FPABI_MATH__;
    528 double	__builtin_nan(const char *) __NDK_FPABI_MATH__ __pure2;
    529 double	__builtin_nextafter(double, double) __NDK_FPABI_MATH__;
    530 double	__builtin_remainder(double, double) __NDK_FPABI_MATH__;
    531 double	__builtin_remquo(double, double, int *) __NDK_FPABI_MATH__;
    532 double	__builtin_rint(double) __NDK_FPABI_MATH__;
    533 #endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
    534 
    535 #if __BSD_VISIBLE || __XSI_VISIBLE
    536 double	__builtin_j0(double) __NDK_FPABI_MATH__;
    537 double	__builtin_j1(double) __NDK_FPABI_MATH__;
    538 double	__builtin_jn(int, double) __NDK_FPABI_MATH__;
    539 double	__builtin_y0(double) __NDK_FPABI_MATH__;
    540 double	__builtin_y1(double) __NDK_FPABI_MATH__;
    541 double	__builtin_yn(int, double) __NDK_FPABI_MATH__;
    542 
    543 #if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
    544 double	__builtin_gamma(double) __NDK_FPABI_MATH__;
    545 #endif
    546 
    547 #if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
    548 double	__builtin_scalb(double, double) __NDK_FPABI_MATH__;
    549 #endif
    550 #endif /* __BSD_VISIBLE || __XSI_VISIBLE */
    551 
    552 #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
    553 double	__builtin_copysign(double, double) __NDK_FPABI_MATH__ __pure2;
    554 double	__builtin_fdim(double, double) __NDK_FPABI_MATH__;
    555 double	__builtin_fmax(double, double) __NDK_FPABI_MATH__ __pure2;
    556 double	__builtin_fmin(double, double) __NDK_FPABI_MATH__ __pure2;
    557 double	__builtin_nearbyint(double) __NDK_FPABI_MATH__;
    558 double	__builtin_round(double) __NDK_FPABI_MATH__;
    559 double	__builtin_scalbln(double, long) __NDK_FPABI_MATH__;
    560 double	__builtin_scalbn(double, int) __NDK_FPABI_MATH__;
    561 double	__builtin_tgamma(double) __NDK_FPABI_MATH__;
    562 double	__builtin_trunc(double) __NDK_FPABI_MATH__;
    563 #endif
    564 
    565 /*
    566  * BSD math library entry points
    567  */
    568 #if __BSD_VISIBLE
    569 double	__builtin_drem(double, double) __NDK_FPABI_MATH__;
    570 int	__builtin_finite(double) __NDK_FPABI_MATH__ __pure2;
    571 int	__builtin_isnanf(float) __NDK_FPABI_MATH__ __pure2;
    572 long double significandl(long double) __NDK_FPABI_MATH__;
    573 
    574 /*
    575  * Reentrant version of gamma & lgamma; passes signgam back by reference
    576  * as the second argument; user must allocate space for signgam.
    577  */
    578 double	__builtin_gamma_r(double, int *) __NDK_FPABI_MATH__;
    579 double	__builtin_lgamma_r(double, int *) __NDK_FPABI_MATH__;
    580 
    581 /*
    582  * IEEE Test Vector
    583  */
    584 double	__builtin_significand(double) __NDK_FPABI_MATH__;
    585 #endif /* __BSD_VISIBLE */
    586 
    587 /* float versions of ANSI/POSIX functions */
    588 #if __ISO_C_VISIBLE >= 1999
    589 float	__builtin_acosf(float) __NDK_FPABI_MATH__;
    590 float	__builtin_asinf(float) __NDK_FPABI_MATH__;
    591 float	__builtin_atanf(float) __NDK_FPABI_MATH__;
    592 float	__builtin_atan2f(float, float) __NDK_FPABI_MATH__;
    593 float	__builtin_cosf(float) __NDK_FPABI_MATH__;
    594 float	__builtin_sinf(float) __NDK_FPABI_MATH__;
    595 float	__builtin_tanf(float) __NDK_FPABI_MATH__;
    596 
    597 float	__builtin_coshf(float) __NDK_FPABI_MATH__;
    598 float	__builtin_sinhf(float) __NDK_FPABI_MATH__;
    599 float	__builtin_tanhf(float) __NDK_FPABI_MATH__;
    600 
    601 float	__builtin_exp2f(float) __NDK_FPABI_MATH__;
    602 float	__builtin_expf(float) __NDK_FPABI_MATH__;
    603 float	__builtin_expm1f(float) __NDK_FPABI_MATH__;
    604 float	__builtin_frexpf(float, int *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
    605 int	__builtin_ilogbf(float) __NDK_FPABI_MATH__ __pure2;
    606 float	__builtin_ldexpf(float, int) __NDK_FPABI_MATH__;
    607 float	__builtin_log10f(float) __NDK_FPABI_MATH__;
    608 float	__builtin_log1pf(float) __NDK_FPABI_MATH__;
    609 float	__builtin_log2f(float) __NDK_FPABI_MATH__;
    610 float	__builtin_logf(float) __NDK_FPABI_MATH__;
    611 float	__builtin_modff(float, float *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
    612 
    613 float	__builtin_powf(float, float) __NDK_FPABI_MATH__;
    614 float	__builtin_sqrtf(float) __NDK_FPABI_MATH__;
    615 
    616 float	__builtin_ceilf(float) __NDK_FPABI_MATH__;
    617 float	__builtin_fabsf(float) __NDK_FPABI_MATH__ __pure2;
    618 float	__builtin_floorf(float) __NDK_FPABI_MATH__;
    619 float	__builtin_fmodf(float, float) __NDK_FPABI_MATH__;
    620 float	__builtin_roundf(float) __NDK_FPABI_MATH__;
    621 
    622 float	__builtin_erff(float) __NDK_FPABI_MATH__;
    623 float	__builtin_erfcf(float) __NDK_FPABI_MATH__;
    624 float	__builtin_hypotf(float, float) __NDK_FPABI_MATH__;
    625 float	__builtin_lgammaf(float) __NDK_FPABI_MATH__;
    626 float	__builtin_tgammaf(float) __NDK_FPABI_MATH__;
    627 
    628 float	__builtin_acoshf(float) __NDK_FPABI_MATH__;
    629 float	__builtin_asinhf(float) __NDK_FPABI_MATH__;
    630 float	__builtin_atanhf(float) __NDK_FPABI_MATH__;
    631 float	__builtin_cbrtf(float) __NDK_FPABI_MATH__;
    632 float	__builtin_logbf(float) __NDK_FPABI_MATH__;
    633 float	__builtin_copysignf(float, float) __NDK_FPABI_MATH__ __pure2;
    634 long long __builtin_llrintf(float) __NDK_FPABI_MATH__;
    635 long long __builtin_llroundf(float) __NDK_FPABI_MATH__;
    636 long	__builtin_lrintf(float) __NDK_FPABI_MATH__;
    637 long	__builtin_lroundf(float) __NDK_FPABI_MATH__;
    638 float	__builtin_nanf(const char *) __NDK_FPABI_MATH__ __pure2;
    639 float	__builtin_nearbyintf(float) __NDK_FPABI_MATH__;
    640 float	__builtin_nextafterf(float, float) __NDK_FPABI_MATH__;
    641 float	__builtin_remainderf(float, float) __NDK_FPABI_MATH__;
    642 float	__builtin_remquof(float, float, int *) __NDK_FPABI_MATH__;
    643 float	__builtin_rintf(float) __NDK_FPABI_MATH__;
    644 float	__builtin_scalblnf(float, long) __NDK_FPABI_MATH__;
    645 float	__builtin_scalbnf(float, int) __NDK_FPABI_MATH__;
    646 float	__builtin_truncf(float) __NDK_FPABI_MATH__;
    647 
    648 float	__builtin_fdimf(float, float) __NDK_FPABI_MATH__;
    649 float	__builtin_fmaf(float, float, float) __NDK_FPABI_MATH__;
    650 float	__builtin_fmaxf(float, float) __NDK_FPABI_MATH__ __pure2;
    651 float	__builtin_fminf(float, float) __NDK_FPABI_MATH__ __pure2;
    652 #endif
    653 
    654 /*
    655  * float versions of BSD math library entry points
    656  */
    657 #if __BSD_VISIBLE
    658 float	__builtin_dremf(float, float) __NDK_FPABI_MATH__;
    659 int	__builtin_finitef(float) __NDK_FPABI_MATH__ __pure2;
    660 float	__builtin_gammaf(float) __NDK_FPABI_MATH__;
    661 float	__builtin_j0f(float) __NDK_FPABI_MATH__;
    662 float	__builtin_j1f(float) __NDK_FPABI_MATH__;
    663 float	__builtin_jnf(int, float) __NDK_FPABI_MATH__;
    664 float	__builtin_scalbf(float, float) __NDK_FPABI_MATH__;
    665 float	__builtin_y0f(float) __NDK_FPABI_MATH__;
    666 float	__builtin_y1f(float) __NDK_FPABI_MATH__;
    667 float	__builtin_ynf(int, float) __NDK_FPABI_MATH__;
    668 
    669 /*
    670  * Float versions of reentrant version of gamma & lgamma; passes
    671  * signgam back by reference as the second argument; user must
    672  * allocate space for signgam.
    673  */
    674 float	__builtin_gammaf_r(float, int *) __NDK_FPABI_MATH__;
    675 float	__builtin_lgammaf_r(float, int *) __NDK_FPABI_MATH__;
    676 
    677 /*
    678  * float version of IEEE Test Vector
    679  */
    680 float	__builtin_significandf(float) __NDK_FPABI_MATH__;
    681 #endif	/* __BSD_VISIBLE */
    682 
    683 /*
    684  * long double versions of ISO/POSIX math functions
    685  */
    686 #if __ISO_C_VISIBLE >= 1999
    687 long double	__builtin_acoshl(long double) __NDK_FPABI_MATH__;
    688 long double	__builtin_acosl(long double) __NDK_FPABI_MATH__;
    689 long double	__builtin_asinhl(long double) __NDK_FPABI_MATH__;
    690 long double	__builtin_asinl(long double) __NDK_FPABI_MATH__;
    691 long double	__builtin_atan2l(long double, long double) __NDK_FPABI_MATH__;
    692 long double	__builtin_atanhl(long double) __NDK_FPABI_MATH__;
    693 long double	__builtin_atanl(long double) __NDK_FPABI_MATH__;
    694 long double	__builtin_cbrtl(long double) __NDK_FPABI_MATH__;
    695 long double	__builtin_ceill(long double) __NDK_FPABI_MATH__;
    696 long double	__builtin_copysignl(long double, long double) __NDK_FPABI_MATH__ __pure2;
    697 long double	__builtin_coshl(long double) __NDK_FPABI_MATH__;
    698 long double	__builtin_cosl(long double) __NDK_FPABI_MATH__;
    699 long double	__builtin_erfcl(long double) __NDK_FPABI_MATH__;
    700 long double	__builtin_erfl(long double) __NDK_FPABI_MATH__;
    701 long double	__builtin_exp2l(long double) __NDK_FPABI_MATH__;
    702 long double	__builtin_expl(long double) __NDK_FPABI_MATH__;
    703 long double	__builtin_expm1l(long double) __NDK_FPABI_MATH__;
    704 long double	__builtin_fabsl(long double) __NDK_FPABI_MATH__ __pure2;
    705 long double	__builtin_fdiml(long double, long double) __NDK_FPABI_MATH__;
    706 long double	__builtin_floorl(long double) __NDK_FPABI_MATH__;
    707 long double	__builtin_fmal(long double, long double, long double) __NDK_FPABI_MATH__;
    708 long double	__builtin_fmaxl(long double, long double) __NDK_FPABI_MATH__ __pure2;
    709 long double	__builtin_fminl(long double, long double) __NDK_FPABI_MATH__ __pure2;
    710 long double	__builtin_fmodl(long double, long double) __NDK_FPABI_MATH__;
    711 long double	__builtin_frexpl(long double value, int *) __NDK_FPABI_MATH__; /* fundamentally !__pure2 */
    712 long double	__builtin_hypotl(long double, long double) __NDK_FPABI_MATH__;
    713 int		__builtin_ilogbl(long double) __NDK_FPABI_MATH__ __pure2;
    714 long double	__builtin_ldexpl(long double, int) __NDK_FPABI_MATH__;
    715 long double	__builtin_lgammal(long double) __NDK_FPABI_MATH__;
    716 long long	__builtin_llrintl(long double) __NDK_FPABI_MATH__;
    717 long long	__builtin_llroundl(long double) __NDK_FPABI_MATH__;
    718 long double	__builtin_log10l(long double) __NDK_FPABI_MATH__;
    719 long double	__builtin_log1pl(long double) __NDK_FPABI_MATH__;
    720 long double	__builtin_log2l(long double) __NDK_FPABI_MATH__;
    721 long double	__builtin_logbl(long double) __NDK_FPABI_MATH__;
    722 long double	__builtin_logl(long double) __NDK_FPABI_MATH__;
    723 long		__builtin_lrintl(long double) __NDK_FPABI_MATH__;
    724 long		__builtin_lroundl(long double) __NDK_FPABI_MATH__;
    725 long double	__builtin_modfl(long double, long double *) __NDK_FPABI_MATH__; /* fundamentally !__pure2 */
    726 long double	__builtin_nanl(const char *) __NDK_FPABI_MATH__ __pure2;
    727 long double	__builtin_nearbyintl(long double) __NDK_FPABI_MATH__;
    728 long double	__builtin_nextafterl(long double, long double) __NDK_FPABI_MATH__;
    729 double		__builtin_nexttoward(double, long double) __NDK_FPABI_MATH__;
    730 float		__builtin_nexttowardf(float, long double) __NDK_FPABI_MATH__;
    731 long double	__builtin_nexttowardl(long double, long double) __NDK_FPABI_MATH__;
    732 long double	__builtin_powl(long double, long double) __NDK_FPABI_MATH__;
    733 long double	__builtin_remainderl(long double, long double) __NDK_FPABI_MATH__;
    734 long double	__builtin_remquol(long double, long double, int *) __NDK_FPABI_MATH__;
    735 long double	__builtin_rintl(long double) __NDK_FPABI_MATH__;
    736 long double	__builtin_roundl(long double) __NDK_FPABI_MATH__;
    737 long double	__builtin_scalblnl(long double, long) __NDK_FPABI_MATH__;
    738 long double	__builtin_scalbnl(long double, int) __NDK_FPABI_MATH__;
    739 long double	__builtin_sinhl(long double) __NDK_FPABI_MATH__;
    740 long double	__builtin_sinl(long double) __NDK_FPABI_MATH__;
    741 long double	__builtin_sqrtl(long double) __NDK_FPABI_MATH__;
    742 long double	__builtin_tanhl(long double) __NDK_FPABI_MATH__;
    743 long double	__builtin_tanl(long double) __NDK_FPABI_MATH__;
    744 long double	__builtin_tgammal(long double) __NDK_FPABI_MATH__;
    745 long double	__builtin_truncl(long double) __NDK_FPABI_MATH__;
    746 
    747 #endif /* __ISO_C_VISIBLE >= 1999 */
    748 
    749 #if defined(_GNU_SOURCE)
    750 void __builtin_sincos(double, double*, double*) __NDK_FPABI_MATH__;
    751 void __builtin_sincosf(float, float*, float*) __NDK_FPABI_MATH__;
    752 void __builtin_sincosl(long double, long double*, long double*) __NDK_FPABI_MATH__;
    753 #endif /* _GNU_SOURCE */
    754 
    755 #pragma GCC visibility pop
    756 __END_DECLS
    757 
    758 #endif /* !_MATH_H_ */
    759