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 */
29extern const union __infinity_un {
30	unsigned char	__uc[8];
31	double		__ud;
32} __infinity;
33
34extern 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
129typedef double __double_t;
130typedef __double_t double_t;
131typedef float __float_t;
132typedef __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)
154extern 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 */
175int	__fpclassifyd(double) __NDK_FPABI_MATH__  __pure2;
176int	__fpclassifyf(float) __NDK_FPABI_MATH__  __pure2;
177int	__fpclassifyl(long double) __NDK_FPABI_MATH__  __pure2;
178int	__isfinitef(float) __NDK_FPABI_MATH__  __pure2;
179int	__isfinite(double) __NDK_FPABI_MATH__  __pure2;
180int	__isfinitel(long double) __NDK_FPABI_MATH__  __pure2;
181int	__isinff(float) __NDK_FPABI_MATH__  __pure2;
182int	__isinfl(long double) __NDK_FPABI_MATH__  __pure2;
183int	__isnanf(float) __NDK_FPABI_MATH__  __pure2;
184int	__isnanl(long double) __NDK_FPABI_MATH__  __pure2;
185int	__isnormalf(float) __NDK_FPABI_MATH__  __pure2;
186int	__isnormal(double) __NDK_FPABI_MATH__  __pure2;
187int	__isnormall(long double) __NDK_FPABI_MATH__  __pure2;
188int	__signbit(double) __NDK_FPABI_MATH__  __pure2;
189int	__signbitf(float) __NDK_FPABI_MATH__  __pure2;
190int	__signbitl(long double) __NDK_FPABI_MATH__  __pure2;
191
192double	acos(double) __NDK_FPABI_MATH__;
193double	asin(double) __NDK_FPABI_MATH__;
194double	atan(double) __NDK_FPABI_MATH__;
195double	atan2(double, double) __NDK_FPABI_MATH__;
196double	cos(double) __NDK_FPABI_MATH__;
197double	sin(double) __NDK_FPABI_MATH__;
198double	tan(double) __NDK_FPABI_MATH__;
199
200double	cosh(double) __NDK_FPABI_MATH__;
201double	sinh(double) __NDK_FPABI_MATH__;
202double	tanh(double) __NDK_FPABI_MATH__;
203
204double	exp(double) __NDK_FPABI_MATH__;
205double	frexp(double, int *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
206double	ldexp(double, int) __NDK_FPABI_MATH__;
207double	log(double) __NDK_FPABI_MATH__;
208double	log10(double) __NDK_FPABI_MATH__;
209double	modf(double, double *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
210
211double	pow(double, double) __NDK_FPABI_MATH__;
212double	sqrt(double) __NDK_FPABI_MATH__;
213
214double	ceil(double) __NDK_FPABI_MATH__;
215double	fabs(double) __NDK_FPABI_MATH__ __pure2;
216double	floor(double) __NDK_FPABI_MATH__;
217double	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
223double	acosh(double) __NDK_FPABI_MATH__;
224double	asinh(double) __NDK_FPABI_MATH__;
225double	atanh(double) __NDK_FPABI_MATH__;
226double	cbrt(double) __NDK_FPABI_MATH__;
227double	erf(double) __NDK_FPABI_MATH__;
228double	erfc(double) __NDK_FPABI_MATH__;
229double	exp2(double) __NDK_FPABI_MATH__;
230double	expm1(double) __NDK_FPABI_MATH__;
231double	fma(double, double, double) __NDK_FPABI_MATH__;
232double	hypot(double, double) __NDK_FPABI_MATH__;
233int	ilogb(double) __NDK_FPABI_MATH__ __pure2;
234int	(isinf)(double) __NDK_FPABI_MATH__ __pure2;
235int	(isnan)(double) __NDK_FPABI_MATH__ __pure2;
236double	lgamma(double) __NDK_FPABI_MATH__;
237long long llrint(double) __NDK_FPABI_MATH__;
238long long llround(double) __NDK_FPABI_MATH__;
239double	log1p(double) __NDK_FPABI_MATH__;
240double	log2(double) __NDK_FPABI_MATH__;
241double	logb(double) __NDK_FPABI_MATH__;
242long	lrint(double) __NDK_FPABI_MATH__;
243long	lround(double) __NDK_FPABI_MATH__;
244double	nan(const char *) __NDK_FPABI_MATH__ __pure2;
245double	nextafter(double, double) __NDK_FPABI_MATH__;
246double	remainder(double, double) __NDK_FPABI_MATH__;
247double	remquo(double, double, int *) __NDK_FPABI_MATH__;
248double	rint(double) __NDK_FPABI_MATH__;
249#endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
250
251#if __BSD_VISIBLE || __XSI_VISIBLE
252double	j0(double) __NDK_FPABI_MATH__;
253double	j1(double) __NDK_FPABI_MATH__;
254double	jn(int, double) __NDK_FPABI_MATH__;
255double	y0(double) __NDK_FPABI_MATH__;
256double	y1(double) __NDK_FPABI_MATH__;
257double	yn(int, double) __NDK_FPABI_MATH__;
258
259#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
260double	gamma(double) __NDK_FPABI_MATH__;
261#endif
262
263#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
264double	scalb(double, double) __NDK_FPABI_MATH__;
265#endif
266#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
267
268#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
269double	copysign(double, double) __NDK_FPABI_MATH__ __pure2;
270double	fdim(double, double) __NDK_FPABI_MATH__;
271double	fmax(double, double) __NDK_FPABI_MATH__ __pure2;
272double	fmin(double, double) __NDK_FPABI_MATH__ __pure2;
273double	nearbyint(double) __NDK_FPABI_MATH__;
274double	round(double) __NDK_FPABI_MATH__;
275double	scalbln(double, long) __NDK_FPABI_MATH__;
276double	scalbn(double, int) __NDK_FPABI_MATH__;
277double	tgamma(double) __NDK_FPABI_MATH__;
278double	trunc(double) __NDK_FPABI_MATH__;
279#endif
280
281/*
282 * BSD math library entry points
283 */
284#if __BSD_VISIBLE
285double	drem(double, double) __NDK_FPABI_MATH__;
286int	finite(double) __NDK_FPABI_MATH__ __pure2;
287int	isnanf(float) __NDK_FPABI_MATH__ __pure2;
288long 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 */
294double	gamma_r(double, int *) __NDK_FPABI_MATH__;
295double	lgamma_r(double, int *) __NDK_FPABI_MATH__;
296
297/*
298 * IEEE Test Vector
299 */
300double	significand(double) __NDK_FPABI_MATH__;
301#endif /* __BSD_VISIBLE */
302
303/* float versions of ANSI/POSIX functions */
304#if __ISO_C_VISIBLE >= 1999
305float	acosf(float) __NDK_FPABI_MATH__;
306float	asinf(float) __NDK_FPABI_MATH__;
307float	atanf(float) __NDK_FPABI_MATH__;
308float	atan2f(float, float) __NDK_FPABI_MATH__;
309float	cosf(float) __NDK_FPABI_MATH__;
310float	sinf(float) __NDK_FPABI_MATH__;
311float	tanf(float) __NDK_FPABI_MATH__;
312
313float	coshf(float) __NDK_FPABI_MATH__;
314float	sinhf(float) __NDK_FPABI_MATH__;
315float	tanhf(float) __NDK_FPABI_MATH__;
316
317float	exp2f(float) __NDK_FPABI_MATH__;
318float	expf(float) __NDK_FPABI_MATH__;
319float	expm1f(float) __NDK_FPABI_MATH__;
320float	frexpf(float, int *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
321int	ilogbf(float) __NDK_FPABI_MATH__ __pure2;
322float	ldexpf(float, int) __NDK_FPABI_MATH__;
323float	log10f(float) __NDK_FPABI_MATH__;
324float	log1pf(float) __NDK_FPABI_MATH__;
325float	log2f(float) __NDK_FPABI_MATH__;
326float	logf(float) __NDK_FPABI_MATH__;
327float	modff(float, float *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
328
329float	powf(float, float) __NDK_FPABI_MATH__;
330float	sqrtf(float) __NDK_FPABI_MATH__;
331
332float	ceilf(float) __NDK_FPABI_MATH__;
333float	fabsf(float) __NDK_FPABI_MATH__ __pure2;
334float	floorf(float) __NDK_FPABI_MATH__;
335float	fmodf(float, float) __NDK_FPABI_MATH__;
336float	roundf(float) __NDK_FPABI_MATH__;
337
338float	erff(float) __NDK_FPABI_MATH__;
339float	erfcf(float) __NDK_FPABI_MATH__;
340float	hypotf(float, float) __NDK_FPABI_MATH__;
341float	lgammaf(float) __NDK_FPABI_MATH__;
342float	tgammaf(float) __NDK_FPABI_MATH__;
343
344float	acoshf(float) __NDK_FPABI_MATH__;
345float	asinhf(float) __NDK_FPABI_MATH__;
346float	atanhf(float) __NDK_FPABI_MATH__;
347float	cbrtf(float) __NDK_FPABI_MATH__;
348float	logbf(float) __NDK_FPABI_MATH__;
349float	copysignf(float, float) __NDK_FPABI_MATH__ __pure2;
350long long llrintf(float) __NDK_FPABI_MATH__;
351long long llroundf(float) __NDK_FPABI_MATH__;
352long	lrintf(float) __NDK_FPABI_MATH__;
353long	lroundf(float) __NDK_FPABI_MATH__;
354float	nanf(const char *) __NDK_FPABI_MATH__ __pure2;
355float	nearbyintf(float) __NDK_FPABI_MATH__;
356float	nextafterf(float, float) __NDK_FPABI_MATH__;
357float	remainderf(float, float) __NDK_FPABI_MATH__;
358float	remquof(float, float, int *) __NDK_FPABI_MATH__;
359float	rintf(float) __NDK_FPABI_MATH__;
360float	scalblnf(float, long) __NDK_FPABI_MATH__;
361float	scalbnf(float, int) __NDK_FPABI_MATH__;
362float	truncf(float) __NDK_FPABI_MATH__;
363
364float	fdimf(float, float) __NDK_FPABI_MATH__;
365float	fmaf(float, float, float) __NDK_FPABI_MATH__;
366float	fmaxf(float, float) __NDK_FPABI_MATH__ __pure2;
367float	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
374float	dremf(float, float) __NDK_FPABI_MATH__;
375int	finitef(float) __NDK_FPABI_MATH__ __pure2;
376float	gammaf(float) __NDK_FPABI_MATH__;
377float	j0f(float) __NDK_FPABI_MATH__;
378float	j1f(float) __NDK_FPABI_MATH__;
379float	jnf(int, float) __NDK_FPABI_MATH__;
380float	scalbf(float, float) __NDK_FPABI_MATH__;
381float	y0f(float) __NDK_FPABI_MATH__;
382float	y1f(float) __NDK_FPABI_MATH__;
383float	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 */
390float	gammaf_r(float, int *) __NDK_FPABI_MATH__;
391float	lgammaf_r(float, int *) __NDK_FPABI_MATH__;
392
393/*
394 * float version of IEEE Test Vector
395 */
396float	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
403long double	acoshl(long double) __NDK_FPABI_MATH__;
404long double	acosl(long double) __NDK_FPABI_MATH__;
405long double	asinhl(long double) __NDK_FPABI_MATH__;
406long double	asinl(long double) __NDK_FPABI_MATH__;
407long double	atan2l(long double, long double) __NDK_FPABI_MATH__;
408long double	atanhl(long double) __NDK_FPABI_MATH__;
409long double	atanl(long double) __NDK_FPABI_MATH__;
410long double	cbrtl(long double) __NDK_FPABI_MATH__;
411long double	ceill(long double) __NDK_FPABI_MATH__;
412long double	copysignl(long double, long double) __NDK_FPABI_MATH__ __pure2;
413long double	coshl(long double) __NDK_FPABI_MATH__;
414long double	cosl(long double) __NDK_FPABI_MATH__;
415long double	erfcl(long double) __NDK_FPABI_MATH__;
416long double	erfl(long double) __NDK_FPABI_MATH__;
417long double	exp2l(long double) __NDK_FPABI_MATH__;
418long double	expl(long double) __NDK_FPABI_MATH__;
419long double	expm1l(long double) __NDK_FPABI_MATH__;
420long double	fabsl(long double) __NDK_FPABI_MATH__ __pure2;
421long double	fdiml(long double, long double) __NDK_FPABI_MATH__;
422long double	floorl(long double) __NDK_FPABI_MATH__;
423long double	fmal(long double, long double, long double) __NDK_FPABI_MATH__;
424long double	fmaxl(long double, long double) __NDK_FPABI_MATH__ __pure2;
425long double	fminl(long double, long double) __NDK_FPABI_MATH__ __pure2;
426long double	fmodl(long double, long double) __NDK_FPABI_MATH__;
427long double	frexpl(long double value, int *) __NDK_FPABI_MATH__; /* fundamentally !__pure2 */
428long double	hypotl(long double, long double) __NDK_FPABI_MATH__;
429int		ilogbl(long double) __NDK_FPABI_MATH__ __pure2;
430long double	ldexpl(long double, int) __NDK_FPABI_MATH__;
431long double	lgammal(long double) __NDK_FPABI_MATH__;
432long long	llrintl(long double) __NDK_FPABI_MATH__;
433long long	llroundl(long double) __NDK_FPABI_MATH__;
434long double	log10l(long double) __NDK_FPABI_MATH__;
435long double	log1pl(long double) __NDK_FPABI_MATH__;
436long double	log2l(long double) __NDK_FPABI_MATH__;
437long double	logbl(long double) __NDK_FPABI_MATH__;
438long double	logl(long double) __NDK_FPABI_MATH__;
439long		lrintl(long double) __NDK_FPABI_MATH__;
440long		lroundl(long double) __NDK_FPABI_MATH__;
441long double	modfl(long double, long double *) __NDK_FPABI_MATH__; /* fundamentally !__pure2 */
442long double	nanl(const char *) __NDK_FPABI_MATH__ __pure2;
443long double	nearbyintl(long double) __NDK_FPABI_MATH__;
444long double	nextafterl(long double, long double) __NDK_FPABI_MATH__;
445double		nexttoward(double, long double) __NDK_FPABI_MATH__;
446float		nexttowardf(float, long double) __NDK_FPABI_MATH__;
447long double	nexttowardl(long double, long double) __NDK_FPABI_MATH__;
448long double	powl(long double, long double) __NDK_FPABI_MATH__;
449long double	remainderl(long double, long double) __NDK_FPABI_MATH__;
450long double	remquol(long double, long double, int *) __NDK_FPABI_MATH__;
451long double	rintl(long double) __NDK_FPABI_MATH__;
452long double	roundl(long double) __NDK_FPABI_MATH__;
453long double	scalblnl(long double, long) __NDK_FPABI_MATH__;
454long double	scalbnl(long double, int) __NDK_FPABI_MATH__;
455long double	sinhl(long double) __NDK_FPABI_MATH__;
456long double	sinl(long double) __NDK_FPABI_MATH__;
457long double	sqrtl(long double) __NDK_FPABI_MATH__;
458long double	tanhl(long double) __NDK_FPABI_MATH__;
459long double	tanl(long double) __NDK_FPABI_MATH__;
460long double	tgammal(long double) __NDK_FPABI_MATH__;
461long double	truncl(long double) __NDK_FPABI_MATH__;
462
463#endif /* __ISO_C_VISIBLE >= 1999 */
464
465#if defined(_GNU_SOURCE)
466void sincos(double, double*, double*) __NDK_FPABI_MATH__;
467void sincosf(float, float*, float*) __NDK_FPABI_MATH__;
468void 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
473double	__builtin_acos(double) __NDK_FPABI_MATH__;
474double	__builtin_asin(double) __NDK_FPABI_MATH__;
475double	__builtin_atan(double) __NDK_FPABI_MATH__;
476double	__builtin_atan2(double, double) __NDK_FPABI_MATH__;
477double	__builtin_cos(double) __NDK_FPABI_MATH__;
478double	__builtin_sin(double) __NDK_FPABI_MATH__;
479double	__builtin_tan(double) __NDK_FPABI_MATH__;
480
481double	__builtin_cosh(double) __NDK_FPABI_MATH__;
482double	__builtin_sinh(double) __NDK_FPABI_MATH__;
483double	__builtin_tanh(double) __NDK_FPABI_MATH__;
484
485double	__builtin_exp(double) __NDK_FPABI_MATH__;
486double	__builtin_frexp(double, int *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
487double	__builtin_ldexp(double, int) __NDK_FPABI_MATH__;
488double	__builtin_log(double) __NDK_FPABI_MATH__;
489double	__builtin_log10(double) __NDK_FPABI_MATH__;
490double	__builtin_modf(double, double *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
491
492double	__builtin_pow(double, double) __NDK_FPABI_MATH__;
493double	__builtin_sqrt(double) __NDK_FPABI_MATH__;
494
495double	__builtin_ceil(double) __NDK_FPABI_MATH__;
496double	__builtin_fabs(double) __NDK_FPABI_MATH__ __pure2;
497double	__builtin_floor(double) __NDK_FPABI_MATH__;
498double	__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
504double	__builtin_acosh(double) __NDK_FPABI_MATH__;
505double	__builtin_asinh(double) __NDK_FPABI_MATH__;
506double	__builtin_atanh(double) __NDK_FPABI_MATH__;
507double	__builtin_cbrt(double) __NDK_FPABI_MATH__;
508double	__builtin_erf(double) __NDK_FPABI_MATH__;
509double	__builtin_erfc(double) __NDK_FPABI_MATH__;
510double	__builtin_exp2(double) __NDK_FPABI_MATH__;
511double	__builtin_expm1(double) __NDK_FPABI_MATH__;
512double	__builtin_fma(double, double, double) __NDK_FPABI_MATH__;
513double	__builtin_hypot(double, double) __NDK_FPABI_MATH__;
514int	__builtin_ilogb(double) __NDK_FPABI_MATH__ __pure2;
515#if !defined(__clang__) || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 7)
516/* See upstream bug http://llvm.org/bugs/show_bug.cgi?id=20958 */
517int	__builtin_isinf(double) __NDK_FPABI_MATH__ __pure2;
518int	__builtin_isnan(double) __NDK_FPABI_MATH__ __pure2;
519#else
520/* clang < 3.7 has faulty prototype for __builtin_isnan */
521#endif
522double	__builtin_lgamma(double) __NDK_FPABI_MATH__;
523long long __builtin_llrint(double) __NDK_FPABI_MATH__;
524long long __builtin_llround(double) __NDK_FPABI_MATH__;
525double	__builtin_log1p(double) __NDK_FPABI_MATH__;
526double	__builtin_log2(double) __NDK_FPABI_MATH__;
527double	__builtin_logb(double) __NDK_FPABI_MATH__;
528long	__builtin_lrint(double) __NDK_FPABI_MATH__;
529long	__builtin_lround(double) __NDK_FPABI_MATH__;
530double	__builtin_nan(const char *) __NDK_FPABI_MATH__ __pure2;
531double	__builtin_nextafter(double, double) __NDK_FPABI_MATH__;
532double	__builtin_remainder(double, double) __NDK_FPABI_MATH__;
533double	__builtin_remquo(double, double, int *) __NDK_FPABI_MATH__;
534double	__builtin_rint(double) __NDK_FPABI_MATH__;
535#endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
536
537#if __BSD_VISIBLE || __XSI_VISIBLE
538double	__builtin_j0(double) __NDK_FPABI_MATH__;
539double	__builtin_j1(double) __NDK_FPABI_MATH__;
540double	__builtin_jn(int, double) __NDK_FPABI_MATH__;
541double	__builtin_y0(double) __NDK_FPABI_MATH__;
542double	__builtin_y1(double) __NDK_FPABI_MATH__;
543double	__builtin_yn(int, double) __NDK_FPABI_MATH__;
544
545#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
546double	__builtin_gamma(double) __NDK_FPABI_MATH__;
547#endif
548
549#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
550double	__builtin_scalb(double, double) __NDK_FPABI_MATH__;
551#endif
552#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
553
554#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
555double	__builtin_copysign(double, double) __NDK_FPABI_MATH__ __pure2;
556double	__builtin_fdim(double, double) __NDK_FPABI_MATH__;
557double	__builtin_fmax(double, double) __NDK_FPABI_MATH__ __pure2;
558double	__builtin_fmin(double, double) __NDK_FPABI_MATH__ __pure2;
559double	__builtin_nearbyint(double) __NDK_FPABI_MATH__;
560double	__builtin_round(double) __NDK_FPABI_MATH__;
561double	__builtin_scalbln(double, long) __NDK_FPABI_MATH__;
562double	__builtin_scalbn(double, int) __NDK_FPABI_MATH__;
563double	__builtin_tgamma(double) __NDK_FPABI_MATH__;
564double	__builtin_trunc(double) __NDK_FPABI_MATH__;
565#endif
566
567/*
568 * BSD math library entry points
569 */
570#if __BSD_VISIBLE
571double	__builtin_drem(double, double) __NDK_FPABI_MATH__;
572int	__builtin_finite(double) __NDK_FPABI_MATH__ __pure2;
573int	__builtin_isnanf(float) __NDK_FPABI_MATH__ __pure2;
574long double significandl(long double) __NDK_FPABI_MATH__;
575
576/*
577 * Reentrant version of gamma & lgamma; passes signgam back by reference
578 * as the second argument; user must allocate space for signgam.
579 */
580double	__builtin_gamma_r(double, int *) __NDK_FPABI_MATH__;
581double	__builtin_lgamma_r(double, int *) __NDK_FPABI_MATH__;
582
583/*
584 * IEEE Test Vector
585 */
586double	__builtin_significand(double) __NDK_FPABI_MATH__;
587#endif /* __BSD_VISIBLE */
588
589/* float versions of ANSI/POSIX functions */
590#if __ISO_C_VISIBLE >= 1999
591float	__builtin_acosf(float) __NDK_FPABI_MATH__;
592float	__builtin_asinf(float) __NDK_FPABI_MATH__;
593float	__builtin_atanf(float) __NDK_FPABI_MATH__;
594float	__builtin_atan2f(float, float) __NDK_FPABI_MATH__;
595float	__builtin_cosf(float) __NDK_FPABI_MATH__;
596float	__builtin_sinf(float) __NDK_FPABI_MATH__;
597float	__builtin_tanf(float) __NDK_FPABI_MATH__;
598
599float	__builtin_coshf(float) __NDK_FPABI_MATH__;
600float	__builtin_sinhf(float) __NDK_FPABI_MATH__;
601float	__builtin_tanhf(float) __NDK_FPABI_MATH__;
602
603float	__builtin_exp2f(float) __NDK_FPABI_MATH__;
604float	__builtin_expf(float) __NDK_FPABI_MATH__;
605float	__builtin_expm1f(float) __NDK_FPABI_MATH__;
606float	__builtin_frexpf(float, int *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
607int	__builtin_ilogbf(float) __NDK_FPABI_MATH__ __pure2;
608float	__builtin_ldexpf(float, int) __NDK_FPABI_MATH__;
609float	__builtin_log10f(float) __NDK_FPABI_MATH__;
610float	__builtin_log1pf(float) __NDK_FPABI_MATH__;
611float	__builtin_log2f(float) __NDK_FPABI_MATH__;
612float	__builtin_logf(float) __NDK_FPABI_MATH__;
613float	__builtin_modff(float, float *) __NDK_FPABI_MATH__;	/* fundamentally !__pure2 */
614
615float	__builtin_powf(float, float) __NDK_FPABI_MATH__;
616float	__builtin_sqrtf(float) __NDK_FPABI_MATH__;
617
618float	__builtin_ceilf(float) __NDK_FPABI_MATH__;
619float	__builtin_fabsf(float) __NDK_FPABI_MATH__ __pure2;
620float	__builtin_floorf(float) __NDK_FPABI_MATH__;
621float	__builtin_fmodf(float, float) __NDK_FPABI_MATH__;
622float	__builtin_roundf(float) __NDK_FPABI_MATH__;
623
624float	__builtin_erff(float) __NDK_FPABI_MATH__;
625float	__builtin_erfcf(float) __NDK_FPABI_MATH__;
626float	__builtin_hypotf(float, float) __NDK_FPABI_MATH__;
627float	__builtin_lgammaf(float) __NDK_FPABI_MATH__;
628float	__builtin_tgammaf(float) __NDK_FPABI_MATH__;
629
630float	__builtin_acoshf(float) __NDK_FPABI_MATH__;
631float	__builtin_asinhf(float) __NDK_FPABI_MATH__;
632float	__builtin_atanhf(float) __NDK_FPABI_MATH__;
633float	__builtin_cbrtf(float) __NDK_FPABI_MATH__;
634float	__builtin_logbf(float) __NDK_FPABI_MATH__;
635float	__builtin_copysignf(float, float) __NDK_FPABI_MATH__ __pure2;
636long long __builtin_llrintf(float) __NDK_FPABI_MATH__;
637long long __builtin_llroundf(float) __NDK_FPABI_MATH__;
638long	__builtin_lrintf(float) __NDK_FPABI_MATH__;
639long	__builtin_lroundf(float) __NDK_FPABI_MATH__;
640float	__builtin_nanf(const char *) __NDK_FPABI_MATH__ __pure2;
641float	__builtin_nearbyintf(float) __NDK_FPABI_MATH__;
642float	__builtin_nextafterf(float, float) __NDK_FPABI_MATH__;
643float	__builtin_remainderf(float, float) __NDK_FPABI_MATH__;
644float	__builtin_remquof(float, float, int *) __NDK_FPABI_MATH__;
645float	__builtin_rintf(float) __NDK_FPABI_MATH__;
646float	__builtin_scalblnf(float, long) __NDK_FPABI_MATH__;
647float	__builtin_scalbnf(float, int) __NDK_FPABI_MATH__;
648float	__builtin_truncf(float) __NDK_FPABI_MATH__;
649
650float	__builtin_fdimf(float, float) __NDK_FPABI_MATH__;
651float	__builtin_fmaf(float, float, float) __NDK_FPABI_MATH__;
652float	__builtin_fmaxf(float, float) __NDK_FPABI_MATH__ __pure2;
653float	__builtin_fminf(float, float) __NDK_FPABI_MATH__ __pure2;
654#endif
655
656/*
657 * float versions of BSD math library entry points
658 */
659#if __BSD_VISIBLE
660float	__builtin_dremf(float, float) __NDK_FPABI_MATH__;
661int	__builtin_finitef(float) __NDK_FPABI_MATH__ __pure2;
662float	__builtin_gammaf(float) __NDK_FPABI_MATH__;
663float	__builtin_j0f(float) __NDK_FPABI_MATH__;
664float	__builtin_j1f(float) __NDK_FPABI_MATH__;
665float	__builtin_jnf(int, float) __NDK_FPABI_MATH__;
666float	__builtin_scalbf(float, float) __NDK_FPABI_MATH__;
667float	__builtin_y0f(float) __NDK_FPABI_MATH__;
668float	__builtin_y1f(float) __NDK_FPABI_MATH__;
669float	__builtin_ynf(int, float) __NDK_FPABI_MATH__;
670
671/*
672 * Float versions of reentrant version of gamma & lgamma; passes
673 * signgam back by reference as the second argument; user must
674 * allocate space for signgam.
675 */
676float	__builtin_gammaf_r(float, int *) __NDK_FPABI_MATH__;
677float	__builtin_lgammaf_r(float, int *) __NDK_FPABI_MATH__;
678
679/*
680 * float version of IEEE Test Vector
681 */
682float	__builtin_significandf(float) __NDK_FPABI_MATH__;
683#endif	/* __BSD_VISIBLE */
684
685/*
686 * long double versions of ISO/POSIX math functions
687 */
688#if __ISO_C_VISIBLE >= 1999
689long double	__builtin_acoshl(long double) __NDK_FPABI_MATH__;
690long double	__builtin_acosl(long double) __NDK_FPABI_MATH__;
691long double	__builtin_asinhl(long double) __NDK_FPABI_MATH__;
692long double	__builtin_asinl(long double) __NDK_FPABI_MATH__;
693long double	__builtin_atan2l(long double, long double) __NDK_FPABI_MATH__;
694long double	__builtin_atanhl(long double) __NDK_FPABI_MATH__;
695long double	__builtin_atanl(long double) __NDK_FPABI_MATH__;
696long double	__builtin_cbrtl(long double) __NDK_FPABI_MATH__;
697long double	__builtin_ceill(long double) __NDK_FPABI_MATH__;
698long double	__builtin_copysignl(long double, long double) __NDK_FPABI_MATH__ __pure2;
699long double	__builtin_coshl(long double) __NDK_FPABI_MATH__;
700long double	__builtin_cosl(long double) __NDK_FPABI_MATH__;
701long double	__builtin_erfcl(long double) __NDK_FPABI_MATH__;
702long double	__builtin_erfl(long double) __NDK_FPABI_MATH__;
703long double	__builtin_exp2l(long double) __NDK_FPABI_MATH__;
704long double	__builtin_expl(long double) __NDK_FPABI_MATH__;
705long double	__builtin_expm1l(long double) __NDK_FPABI_MATH__;
706long double	__builtin_fabsl(long double) __NDK_FPABI_MATH__ __pure2;
707long double	__builtin_fdiml(long double, long double) __NDK_FPABI_MATH__;
708long double	__builtin_floorl(long double) __NDK_FPABI_MATH__;
709long double	__builtin_fmal(long double, long double, long double) __NDK_FPABI_MATH__;
710long double	__builtin_fmaxl(long double, long double) __NDK_FPABI_MATH__ __pure2;
711long double	__builtin_fminl(long double, long double) __NDK_FPABI_MATH__ __pure2;
712long double	__builtin_fmodl(long double, long double) __NDK_FPABI_MATH__;
713long double	__builtin_frexpl(long double value, int *) __NDK_FPABI_MATH__; /* fundamentally !__pure2 */
714long double	__builtin_hypotl(long double, long double) __NDK_FPABI_MATH__;
715int		__builtin_ilogbl(long double) __NDK_FPABI_MATH__ __pure2;
716long double	__builtin_ldexpl(long double, int) __NDK_FPABI_MATH__;
717long double	__builtin_lgammal(long double) __NDK_FPABI_MATH__;
718long long	__builtin_llrintl(long double) __NDK_FPABI_MATH__;
719long long	__builtin_llroundl(long double) __NDK_FPABI_MATH__;
720long double	__builtin_log10l(long double) __NDK_FPABI_MATH__;
721long double	__builtin_log1pl(long double) __NDK_FPABI_MATH__;
722long double	__builtin_log2l(long double) __NDK_FPABI_MATH__;
723long double	__builtin_logbl(long double) __NDK_FPABI_MATH__;
724long double	__builtin_logl(long double) __NDK_FPABI_MATH__;
725long		__builtin_lrintl(long double) __NDK_FPABI_MATH__;
726long		__builtin_lroundl(long double) __NDK_FPABI_MATH__;
727long double	__builtin_modfl(long double, long double *) __NDK_FPABI_MATH__; /* fundamentally !__pure2 */
728long double	__builtin_nanl(const char *) __NDK_FPABI_MATH__ __pure2;
729long double	__builtin_nearbyintl(long double) __NDK_FPABI_MATH__;
730long double	__builtin_nextafterl(long double, long double) __NDK_FPABI_MATH__;
731double		__builtin_nexttoward(double, long double) __NDK_FPABI_MATH__;
732float		__builtin_nexttowardf(float, long double) __NDK_FPABI_MATH__;
733long double	__builtin_nexttowardl(long double, long double) __NDK_FPABI_MATH__;
734long double	__builtin_powl(long double, long double) __NDK_FPABI_MATH__;
735long double	__builtin_remainderl(long double, long double) __NDK_FPABI_MATH__;
736long double	__builtin_remquol(long double, long double, int *) __NDK_FPABI_MATH__;
737long double	__builtin_rintl(long double) __NDK_FPABI_MATH__;
738long double	__builtin_roundl(long double) __NDK_FPABI_MATH__;
739long double	__builtin_scalblnl(long double, long) __NDK_FPABI_MATH__;
740long double	__builtin_scalbnl(long double, int) __NDK_FPABI_MATH__;
741long double	__builtin_sinhl(long double) __NDK_FPABI_MATH__;
742long double	__builtin_sinl(long double) __NDK_FPABI_MATH__;
743long double	__builtin_sqrtl(long double) __NDK_FPABI_MATH__;
744long double	__builtin_tanhl(long double) __NDK_FPABI_MATH__;
745long double	__builtin_tanl(long double) __NDK_FPABI_MATH__;
746long double	__builtin_tgammal(long double) __NDK_FPABI_MATH__;
747long double	__builtin_truncl(long double) __NDK_FPABI_MATH__;
748
749#endif /* __ISO_C_VISIBLE >= 1999 */
750
751#if defined(_GNU_SOURCE)
752void __builtin_sincos(double, double*, double*) __NDK_FPABI_MATH__;
753void __builtin_sincosf(float, float*, float*) __NDK_FPABI_MATH__;
754void __builtin_sincosl(long double, long double*, long double*) __NDK_FPABI_MATH__;
755#endif /* _GNU_SOURCE */
756
757#pragma GCC visibility pop
758__END_DECLS
759
760#endif /* !_MATH_H_ */
761