xref: /freebsd/lib/msun/src/math.h (revision 6b69e627a8d4ff4f1cca214793df961879ffc1ea)
13a8617a8SJordan K. Hubbard /*
23a8617a8SJordan K. Hubbard  * ====================================================
33a8617a8SJordan K. Hubbard  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
43a8617a8SJordan K. Hubbard  *
53a8617a8SJordan K. Hubbard  * Developed at SunPro, a Sun Microsystems, Inc. business.
63a8617a8SJordan K. Hubbard  * Permission to use, copy, modify, and distribute this
73a8617a8SJordan K. Hubbard  * software is freely granted, provided that this notice
83a8617a8SJordan K. Hubbard  * is preserved.
93a8617a8SJordan K. Hubbard  * ====================================================
103a8617a8SJordan K. Hubbard  */
113a8617a8SJordan K. Hubbard 
123a8617a8SJordan K. Hubbard /*
133a8617a8SJordan K. Hubbard  * from: @(#)fdlibm.h 5.1 93/09/24
147f3dea24SPeter Wemm  * $FreeBSD$
153a8617a8SJordan K. Hubbard  */
163a8617a8SJordan K. Hubbard 
173a8617a8SJordan K. Hubbard #ifndef _MATH_H_
183a8617a8SJordan K. Hubbard #define	_MATH_H_
193a8617a8SJordan K. Hubbard 
20207bc1d7SDavid Schultz #include <sys/cdefs.h>
218cf5ed51SMike Barcroft #include <sys/_types.h>
2283bc8931SStefan Farfeleder #include <machine/_limits.h>
238cf5ed51SMike Barcroft 
243a8617a8SJordan K. Hubbard /*
253a8617a8SJordan K. Hubbard  * ANSI/POSIX
263a8617a8SJordan K. Hubbard  */
2783999f5aSArchie Cobbs extern const union __infinity_un {
2883999f5aSArchie Cobbs 	unsigned char	__uc[8];
2983999f5aSArchie Cobbs 	double		__ud;
3083999f5aSArchie Cobbs } __infinity;
318cf5ed51SMike Barcroft 
328cf5ed51SMike Barcroft extern const union __nan_un {
338cf5ed51SMike Barcroft 	unsigned char	__uc[sizeof(float)];
348cf5ed51SMike Barcroft 	float		__uf;
358cf5ed51SMike Barcroft } __nan;
368cf5ed51SMike Barcroft 
37d622ef69SDavid Schultz #if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
38b2d5d0b3SDavid Schultz #define	__MATH_BUILTIN_CONSTANTS
39b2d5d0b3SDavid Schultz #endif
40b2d5d0b3SDavid Schultz 
41d622ef69SDavid Schultz #if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER)
42b2d5d0b3SDavid Schultz #define	__MATH_BUILTIN_RELOPS
43b2d5d0b3SDavid Schultz #endif
44b2d5d0b3SDavid Schultz 
45b2d5d0b3SDavid Schultz #ifdef __MATH_BUILTIN_CONSTANTS
46b2d5d0b3SDavid Schultz #define	HUGE_VAL	__builtin_huge_val()
47b2d5d0b3SDavid Schultz #else
488f3f7c66SDavid Schultz #define	HUGE_VAL	(__infinity.__ud)
49b2d5d0b3SDavid Schultz #endif
508f3f7c66SDavid Schultz 
518f3f7c66SDavid Schultz #if __ISO_C_VISIBLE >= 1999
5283bc8931SStefan Farfeleder #define	FP_ILOGB0	(-__INT_MAX)
5383bc8931SStefan Farfeleder #define	FP_ILOGBNAN	__INT_MAX
54b2d5d0b3SDavid Schultz 
55b2d5d0b3SDavid Schultz #ifdef __MATH_BUILTIN_CONSTANTS
56b2d5d0b3SDavid Schultz #define	HUGE_VALF	__builtin_huge_valf()
57b2d5d0b3SDavid Schultz #define	HUGE_VALL	__builtin_huge_vall()
584984f138SDavid Schultz #define	INFINITY	__builtin_inff()
594984f138SDavid Schultz #define	NAN		__builtin_nanf("")
60b2d5d0b3SDavid Schultz #else
618cf5ed51SMike Barcroft #define	HUGE_VALF	(float)HUGE_VAL
628cf5ed51SMike Barcroft #define	HUGE_VALL	(long double)HUGE_VAL
638cf5ed51SMike Barcroft #define	INFINITY	HUGE_VALF
648cf5ed51SMike Barcroft #define	NAN		(__nan.__uf)
65b2d5d0b3SDavid Schultz #endif /* __MATH_BUILTIN_CONSTANTS */
668cf5ed51SMike Barcroft 
676eb2d83eSBruce Evans #define	MATH_ERRNO	1
686eb2d83eSBruce Evans #define	MATH_ERREXCEPT	2
69ce4e53c4SDavid Schultz #define	math_errhandling	MATH_ERREXCEPT
706eb2d83eSBruce Evans 
7115d5d9deSDavid Schultz #define	FP_FAST_FMAF	1
72228ad57dSDavid Schultz #ifdef __ia64__
7315d5d9deSDavid Schultz #define	FP_FAST_FMA	1
74ea8e2579SDavid Schultz #define	FP_FAST_FMAL	1
75228ad57dSDavid Schultz #endif
76d5580d09SDavid Schultz 
778cf5ed51SMike Barcroft /* Symbolic constants to classify floating point numbers. */
785d62092fSMike Barcroft #define	FP_INFINITE	0x01
795d62092fSMike Barcroft #define	FP_NAN		0x02
805d62092fSMike Barcroft #define	FP_NORMAL	0x04
815d62092fSMike Barcroft #define	FP_SUBNORMAL	0x08
825d62092fSMike Barcroft #define	FP_ZERO		0x10
835d62092fSMike Barcroft 
841583bcb4SDavid Chisnall #if (__STDC_VERSION__ >= 201112L && defined(__clang__)) || \
851583bcb4SDavid Chisnall     __has_extension(c_generic_selections)
86b8f19c92SDavid Chisnall #define	__fp_type_select(x, f, d, ld) _Generic((0,(x)),			\
87a3fc79deSDavid Chisnall     float: f(x),							\
88a3fc79deSDavid Chisnall     double: d(x),							\
89b8f19c92SDavid Chisnall     long double: ld(x))
901583bcb4SDavid Chisnall #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
91a3fc79deSDavid Chisnall #define	__fp_type_select(x, f, d, ld) __builtin_choose_expr(		\
92a3fc79deSDavid Chisnall     __builtin_types_compatible_p(__typeof(x), long double), ld(x),	\
93a3fc79deSDavid Chisnall     __builtin_choose_expr(						\
94a3fc79deSDavid Chisnall     __builtin_types_compatible_p(__typeof(x), double), d(x),		\
95a3fc79deSDavid Chisnall     __builtin_choose_expr(						\
96a3fc79deSDavid Chisnall     __builtin_types_compatible_p(__typeof(x), float), f(x), (void)0)))
97a3fc79deSDavid Chisnall #else
98a3fc79deSDavid Chisnall #define	 __fp_type_select(x, f, d, ld)					\
99a3fc79deSDavid Chisnall     ((sizeof(x) == sizeof(float)) ? f(x)				\
100a3fc79deSDavid Chisnall     : (sizeof(x) == sizeof(double)) ? d(x)				\
101a3fc79deSDavid Chisnall     : ld(x))
102a3fc79deSDavid Chisnall #endif
103a3fc79deSDavid Chisnall 
104a3fc79deSDavid Chisnall #define	fpclassify(x) \
10595f82796SDavid Chisnall 	__fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyl)
106a3fc79deSDavid Chisnall #define	isfinite(x) __fp_type_select(x, __isfinitef, __isfinite, __isfinitel)
107a3fc79deSDavid Chisnall #define	isinf(x) __fp_type_select(x, __isinff, __isinf, __isinfl)
108240dbabfSDavid Schultz #define	isnan(x) \
109a3fc79deSDavid Chisnall 	__fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl)
110a3fc79deSDavid Chisnall #define	isnormal(x) __fp_type_select(x, __isnormalf, __isnormal, __isnormall)
1115d62092fSMike Barcroft 
112b2d5d0b3SDavid Schultz #ifdef __MATH_BUILTIN_RELOPS
113b2d5d0b3SDavid Schultz #define	isgreater(x, y)		__builtin_isgreater((x), (y))
114b2d5d0b3SDavid Schultz #define	isgreaterequal(x, y)	__builtin_isgreaterequal((x), (y))
115b2d5d0b3SDavid Schultz #define	isless(x, y)		__builtin_isless((x), (y))
116b2d5d0b3SDavid Schultz #define	islessequal(x, y)	__builtin_islessequal((x), (y))
117b2d5d0b3SDavid Schultz #define	islessgreater(x, y)	__builtin_islessgreater((x), (y))
118b2d5d0b3SDavid Schultz #define	isunordered(x, y)	__builtin_isunordered((x), (y))
119b2d5d0b3SDavid Schultz #else
1205d62092fSMike Barcroft #define	isgreater(x, y)		(!isunordered((x), (y)) && (x) > (y))
1215d62092fSMike Barcroft #define	isgreaterequal(x, y)	(!isunordered((x), (y)) && (x) >= (y))
1225d62092fSMike Barcroft #define	isless(x, y)		(!isunordered((x), (y)) && (x) < (y))
1235d62092fSMike Barcroft #define	islessequal(x, y)	(!isunordered((x), (y)) && (x) <= (y))
1245d62092fSMike Barcroft #define	islessgreater(x, y)	(!isunordered((x), (y)) && \
1255d62092fSMike Barcroft 					((x) > (y) || (y) > (x)))
1265d62092fSMike Barcroft #define	isunordered(x, y)	(isnan(x) || isnan(y))
127b2d5d0b3SDavid Schultz #endif /* __MATH_BUILTIN_RELOPS */
1285d62092fSMike Barcroft 
129a3fc79deSDavid Chisnall #define	signbit(x) __fp_type_select(x, __signbitf, __signbit, __signbitl)
1308cf5ed51SMike Barcroft 
1318cf5ed51SMike Barcroft typedef	__double_t	double_t;
1328cf5ed51SMike Barcroft typedef	__float_t	float_t;
1338f3f7c66SDavid Schultz #endif /* __ISO_C_VISIBLE >= 1999 */
1343a8617a8SJordan K. Hubbard 
1353a8617a8SJordan K. Hubbard /*
1363a8617a8SJordan K. Hubbard  * XOPEN/SVID
1373a8617a8SJordan K. Hubbard  */
1388f3f7c66SDavid Schultz #if __BSD_VISIBLE || __XSI_VISIBLE
1393a8617a8SJordan K. Hubbard #define	M_E		2.7182818284590452354	/* e */
1403a8617a8SJordan K. Hubbard #define	M_LOG2E		1.4426950408889634074	/* log 2e */
1413a8617a8SJordan K. Hubbard #define	M_LOG10E	0.43429448190325182765	/* log 10e */
1423a8617a8SJordan K. Hubbard #define	M_LN2		0.69314718055994530942	/* log e2 */
1433a8617a8SJordan K. Hubbard #define	M_LN10		2.30258509299404568402	/* log e10 */
1443a8617a8SJordan K. Hubbard #define	M_PI		3.14159265358979323846	/* pi */
1453a8617a8SJordan K. Hubbard #define	M_PI_2		1.57079632679489661923	/* pi/2 */
1463a8617a8SJordan K. Hubbard #define	M_PI_4		0.78539816339744830962	/* pi/4 */
1473a8617a8SJordan K. Hubbard #define	M_1_PI		0.31830988618379067154	/* 1/pi */
1483a8617a8SJordan K. Hubbard #define	M_2_PI		0.63661977236758134308	/* 2/pi */
1493a8617a8SJordan K. Hubbard #define	M_2_SQRTPI	1.12837916709551257390	/* 2/sqrt(pi) */
1503a8617a8SJordan K. Hubbard #define	M_SQRT2		1.41421356237309504880	/* sqrt(2) */
1513a8617a8SJordan K. Hubbard #define	M_SQRT1_2	0.70710678118654752440	/* 1/sqrt(2) */
1523a8617a8SJordan K. Hubbard 
1533a8617a8SJordan K. Hubbard #define	MAXFLOAT	((float)3.40282346638528860e+38)
1543a8617a8SJordan K. Hubbard extern int signgam;
1558f3f7c66SDavid Schultz #endif /* __BSD_VISIBLE || __XSI_VISIBLE */
1563a8617a8SJordan K. Hubbard 
1578f3f7c66SDavid Schultz #if __BSD_VISIBLE
15871936f35SDavid Schultz #if 0
15971936f35SDavid Schultz /* Old value from 4.4BSD-Lite math.h; this is probably better. */
16071936f35SDavid Schultz #define	HUGE		HUGE_VAL
16171936f35SDavid Schultz #else
16271936f35SDavid Schultz #define	HUGE		MAXFLOAT
16371936f35SDavid Schultz #endif
1648f3f7c66SDavid Schultz #endif /* __BSD_VISIBLE */
1653a8617a8SJordan K. Hubbard 
166219cbe10SBruce Evans /*
167b6e65225SDavid Schultz  * Most of these functions depend on the rounding mode and have the side
168b6e65225SDavid Schultz  * effect of raising floating-point exceptions, so they are not declared
169b6e65225SDavid Schultz  * as __pure2.  In C99, FENV_ACCESS affects the purity of these functions.
170219cbe10SBruce Evans  */
1716898f8c4SBruce Evans __BEGIN_DECLS
1723a8617a8SJordan K. Hubbard /*
1733a8617a8SJordan K. Hubbard  * ANSI/POSIX
1743a8617a8SJordan K. Hubbard  */
1755d62092fSMike Barcroft int	__fpclassifyd(double) __pure2;
1765d62092fSMike Barcroft int	__fpclassifyf(float) __pure2;
1775d62092fSMike Barcroft int	__fpclassifyl(long double) __pure2;
178240dbabfSDavid Schultz int	__isfinitef(float) __pure2;
179240dbabfSDavid Schultz int	__isfinite(double) __pure2;
180240dbabfSDavid Schultz int	__isfinitel(long double) __pure2;
181240dbabfSDavid Schultz int	__isinff(float) __pure2;
182a3fc79deSDavid Chisnall int	__isinf(double) __pure2;
183240dbabfSDavid Schultz int	__isinfl(long double) __pure2;
184240dbabfSDavid Schultz int	__isnormalf(float) __pure2;
185240dbabfSDavid Schultz int	__isnormal(double) __pure2;
186240dbabfSDavid Schultz int	__isnormall(long double) __pure2;
1875d62092fSMike Barcroft int	__signbit(double) __pure2;
188ec79bc0dSDavid Schultz int	__signbitf(float) __pure2;
189ec79bc0dSDavid Schultz int	__signbitl(long double) __pure2;
1908cf5ed51SMike Barcroft 
191a3fc79deSDavid Chisnall static __inline int
192e21be487SDavid Chisnall __inline_isnan(__const double __x)
193a3fc79deSDavid Chisnall {
194a3fc79deSDavid Chisnall 
195a3fc79deSDavid Chisnall 	return (__x != __x);
196a3fc79deSDavid Chisnall }
197a3fc79deSDavid Chisnall 
198a3fc79deSDavid Chisnall static __inline int
199e21be487SDavid Chisnall __inline_isnanf(__const float __x)
200a3fc79deSDavid Chisnall {
201a3fc79deSDavid Chisnall 
202a3fc79deSDavid Chisnall 	return (__x != __x);
203a3fc79deSDavid Chisnall }
204a3fc79deSDavid Chisnall 
205a3fc79deSDavid Chisnall static __inline int
206e21be487SDavid Chisnall __inline_isnanl(__const long double __x)
207a3fc79deSDavid Chisnall {
208a3fc79deSDavid Chisnall 
209a3fc79deSDavid Chisnall 	return (__x != __x);
210a3fc79deSDavid Chisnall }
211a3fc79deSDavid Chisnall 
212*6b69e627SDavid Chisnall /*
213*6b69e627SDavid Chisnall  * Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and
214*6b69e627SDavid Chisnall  * isinf() as functions taking double.  C99, and the subsequent POSIX revisions
215*6b69e627SDavid Chisnall  * (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating
216*6b69e627SDavid Chisnall  * point type.  If we are targeting SUSv2 and C99 or C11 (or C++11) then we
217*6b69e627SDavid Chisnall  * expose the newer definition, assuming that the language spec takes
218*6b69e627SDavid Chisnall  * precedence over the operating system interface spec.
219*6b69e627SDavid Chisnall  */
220*6b69e627SDavid Chisnall #if	__XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 && __ISO_C_VISIBLE < 1999
221*6b69e627SDavid Chisnall #undef isinf
222*6b69e627SDavid Chisnall #undef isnan
223*6b69e627SDavid Chisnall int	isinf(double);
224*6b69e627SDavid Chisnall int	isnan(double);
225*6b69e627SDavid Chisnall #endif
226*6b69e627SDavid Chisnall 
22769160b1eSDavid E. O'Brien double	acos(double);
22869160b1eSDavid E. O'Brien double	asin(double);
22969160b1eSDavid E. O'Brien double	atan(double);
23069160b1eSDavid E. O'Brien double	atan2(double, double);
23169160b1eSDavid E. O'Brien double	cos(double);
23269160b1eSDavid E. O'Brien double	sin(double);
23369160b1eSDavid E. O'Brien double	tan(double);
2343a8617a8SJordan K. Hubbard 
23569160b1eSDavid E. O'Brien double	cosh(double);
23669160b1eSDavid E. O'Brien double	sinh(double);
23769160b1eSDavid E. O'Brien double	tanh(double);
2383a8617a8SJordan K. Hubbard 
23969160b1eSDavid E. O'Brien double	exp(double);
240219cbe10SBruce Evans double	frexp(double, int *);	/* fundamentally !__pure2 */
24169160b1eSDavid E. O'Brien double	ldexp(double, int);
24269160b1eSDavid E. O'Brien double	log(double);
24369160b1eSDavid E. O'Brien double	log10(double);
244219cbe10SBruce Evans double	modf(double, double *);	/* fundamentally !__pure2 */
2453a8617a8SJordan K. Hubbard 
24669160b1eSDavid E. O'Brien double	pow(double, double);
24769160b1eSDavid E. O'Brien double	sqrt(double);
2483a8617a8SJordan K. Hubbard 
24969160b1eSDavid E. O'Brien double	ceil(double);
250b6e65225SDavid Schultz double	fabs(double) __pure2;
25169160b1eSDavid E. O'Brien double	floor(double);
25269160b1eSDavid E. O'Brien double	fmod(double, double);
2533a8617a8SJordan K. Hubbard 
254219cbe10SBruce Evans /*
255b6e65225SDavid Schultz  * These functions are not in C90.
256219cbe10SBruce Evans  */
2578f3f7c66SDavid Schultz #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE
25869160b1eSDavid E. O'Brien double	acosh(double);
25969160b1eSDavid E. O'Brien double	asinh(double);
26069160b1eSDavid E. O'Brien double	atanh(double);
261b6e65225SDavid Schultz double	cbrt(double);
2628f3f7c66SDavid Schultz double	erf(double);
263b6e65225SDavid Schultz double	erfc(double);
264f8d6ede6SDavid Schultz double	exp2(double);
265b6e65225SDavid Schultz double	expm1(double);
26621122beaSDavid Schultz double	fma(double, double, double);
2678f3f7c66SDavid Schultz double	hypot(double, double);
268b6e65225SDavid Schultz int	ilogb(double) __pure2;
2698f3f7c66SDavid Schultz double	lgamma(double);
27010c9ffa4SDavid Schultz long long llrint(double);
27110c9ffa4SDavid Schultz long long llround(double);
272b6e65225SDavid Schultz double	log1p(double);
273177668d1SDavid Schultz double	log2(double);
274b6e65225SDavid Schultz double	logb(double);
27510c9ffa4SDavid Schultz long	lrint(double);
27610c9ffa4SDavid Schultz long	lround(double);
2774b6b5744SDavid Schultz double	nan(const char *) __pure2;
27869160b1eSDavid E. O'Brien double	nextafter(double, double);
27969160b1eSDavid E. O'Brien double	remainder(double, double);
2803b9141eeSDavid Schultz double	remquo(double, double, int *);
281b6e65225SDavid Schultz double	rint(double);
2828f3f7c66SDavid Schultz #endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
2833a8617a8SJordan K. Hubbard 
2848f3f7c66SDavid Schultz #if __BSD_VISIBLE || __XSI_VISIBLE
2858f3f7c66SDavid Schultz double	j0(double);
2868f3f7c66SDavid Schultz double	j1(double);
2878f3f7c66SDavid Schultz double	jn(int, double);
2888f3f7c66SDavid Schultz double	y0(double);
2898f3f7c66SDavid Schultz double	y1(double);
2908f3f7c66SDavid Schultz double	yn(int, double);
2918f3f7c66SDavid Schultz 
2928f3f7c66SDavid Schultz #if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
2938f3f7c66SDavid Schultz double	gamma(double);
2946a9280beSBruce Evans #endif
295fbaabc11SDavid Schultz 
296fbaabc11SDavid Schultz #if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
297fbaabc11SDavid Schultz double	scalb(double, double);
298fbaabc11SDavid Schultz #endif
2998f3f7c66SDavid Schultz #endif /* __BSD_VISIBLE || __XSI_VISIBLE */
3008f3f7c66SDavid Schultz 
3018f3f7c66SDavid Schultz #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
3028f3f7c66SDavid Schultz double	copysign(double, double) __pure2;
3039979bae3SStefan Farfeleder double	fdim(double, double);
3049979bae3SStefan Farfeleder double	fmax(double, double) __pure2;
3059979bae3SStefan Farfeleder double	fmin(double, double) __pure2;
306b6e65225SDavid Schultz double	nearbyint(double);
3079979bae3SStefan Farfeleder double	round(double);
30862247e90SDavid Schultz double	scalbln(double, long);
3098f3f7c66SDavid Schultz double	scalbn(double, int);
3108f3f7c66SDavid Schultz double	tgamma(double);
3119979bae3SStefan Farfeleder double	trunc(double);
3128f3f7c66SDavid Schultz #endif
3138f3f7c66SDavid Schultz 
3148f3f7c66SDavid Schultz /*
3158f3f7c66SDavid Schultz  * BSD math library entry points
3168f3f7c66SDavid Schultz  */
3178f3f7c66SDavid Schultz #if __BSD_VISIBLE
3188f3f7c66SDavid Schultz double	drem(double, double);
3198f3f7c66SDavid Schultz int	finite(double) __pure2;
320240dbabfSDavid Schultz int	isnanf(float) __pure2;
3218f3f7c66SDavid Schultz 
3228f3f7c66SDavid Schultz /*
3238f3f7c66SDavid Schultz  * Reentrant version of gamma & lgamma; passes signgam back by reference
3248f3f7c66SDavid Schultz  * as the second argument; user must allocate space for signgam.
3258f3f7c66SDavid Schultz  */
3268f3f7c66SDavid Schultz double	gamma_r(double, int *);
3278f3f7c66SDavid Schultz double	lgamma_r(double, int *);
3283a8617a8SJordan K. Hubbard 
3293a8617a8SJordan K. Hubbard /*
3303a8617a8SJordan K. Hubbard  * IEEE Test Vector
3313a8617a8SJordan K. Hubbard  */
33269160b1eSDavid E. O'Brien double	significand(double);
333457f6cd2SWarner Losh #endif /* __BSD_VISIBLE */
3343a8617a8SJordan K. Hubbard 
3353a8617a8SJordan K. Hubbard /* float versions of ANSI/POSIX functions */
3368f3f7c66SDavid Schultz #if __ISO_C_VISIBLE >= 1999
33769160b1eSDavid E. O'Brien float	acosf(float);
33869160b1eSDavid E. O'Brien float	asinf(float);
33969160b1eSDavid E. O'Brien float	atanf(float);
34069160b1eSDavid E. O'Brien float	atan2f(float, float);
34169160b1eSDavid E. O'Brien float	cosf(float);
34269160b1eSDavid E. O'Brien float	sinf(float);
34369160b1eSDavid E. O'Brien float	tanf(float);
3443a8617a8SJordan K. Hubbard 
34569160b1eSDavid E. O'Brien float	coshf(float);
34669160b1eSDavid E. O'Brien float	sinhf(float);
34769160b1eSDavid E. O'Brien float	tanhf(float);
3483a8617a8SJordan K. Hubbard 
349f8d6ede6SDavid Schultz float	exp2f(float);
35069160b1eSDavid E. O'Brien float	expf(float);
351b6e65225SDavid Schultz float	expm1f(float);
352219cbe10SBruce Evans float	frexpf(float, int *);	/* fundamentally !__pure2 */
353b6e65225SDavid Schultz int	ilogbf(float) __pure2;
35469160b1eSDavid E. O'Brien float	ldexpf(float, int);
35569160b1eSDavid E. O'Brien float	log10f(float);
356b6e65225SDavid Schultz float	log1pf(float);
357177668d1SDavid Schultz float	log2f(float);
3588f3f7c66SDavid Schultz float	logf(float);
359219cbe10SBruce Evans float	modff(float, float *);	/* fundamentally !__pure2 */
3603a8617a8SJordan K. Hubbard 
36169160b1eSDavid E. O'Brien float	powf(float, float);
36269160b1eSDavid E. O'Brien float	sqrtf(float);
3633a8617a8SJordan K. Hubbard 
36469160b1eSDavid E. O'Brien float	ceilf(float);
365b6e65225SDavid Schultz float	fabsf(float) __pure2;
36669160b1eSDavid E. O'Brien float	floorf(float);
36769160b1eSDavid E. O'Brien float	fmodf(float, float);
368d0f13633SDavid Schultz float	roundf(float);
3693a8617a8SJordan K. Hubbard 
37069160b1eSDavid E. O'Brien float	erff(float);
371b6e65225SDavid Schultz float	erfcf(float);
372b6e65225SDavid Schultz float	hypotf(float, float);
37369160b1eSDavid E. O'Brien float	lgammaf(float);
37471c11dd5SDavid Schultz float	tgammaf(float);
3753a8617a8SJordan K. Hubbard 
37669160b1eSDavid E. O'Brien float	acoshf(float);
37769160b1eSDavid E. O'Brien float	asinhf(float);
37869160b1eSDavid E. O'Brien float	atanhf(float);
379b6e65225SDavid Schultz float	cbrtf(float);
380b6e65225SDavid Schultz float	logbf(float);
3818f3f7c66SDavid Schultz float	copysignf(float, float) __pure2;
38210c9ffa4SDavid Schultz long long llrintf(float);
38310c9ffa4SDavid Schultz long long llroundf(float);
38410c9ffa4SDavid Schultz long	lrintf(float);
38510c9ffa4SDavid Schultz long	lroundf(float);
3864b6b5744SDavid Schultz float	nanf(const char *) __pure2;
387b6e65225SDavid Schultz float	nearbyintf(float);
38869160b1eSDavid E. O'Brien float	nextafterf(float, float);
38969160b1eSDavid E. O'Brien float	remainderf(float, float);
3903b9141eeSDavid Schultz float	remquof(float, float, int *);
39169160b1eSDavid E. O'Brien float	rintf(float);
39262247e90SDavid Schultz float	scalblnf(float, long);
39369160b1eSDavid E. O'Brien float	scalbnf(float, int);
39462247e90SDavid Schultz float	truncf(float);
3954f82cb46SDavid Schultz 
3964f82cb46SDavid Schultz float	fdimf(float, float);
39721122beaSDavid Schultz float	fmaf(float, float, float);
3984f82cb46SDavid Schultz float	fmaxf(float, float) __pure2;
3994f82cb46SDavid Schultz float	fminf(float, float) __pure2;
4008f3f7c66SDavid Schultz #endif
4013a8617a8SJordan K. Hubbard 
4023a8617a8SJordan K. Hubbard /*
4033a8617a8SJordan K. Hubbard  * float versions of BSD math library entry points
4043a8617a8SJordan K. Hubbard  */
4058f3f7c66SDavid Schultz #if __BSD_VISIBLE
40669160b1eSDavid E. O'Brien float	dremf(float, float);
4078f3f7c66SDavid Schultz int	finitef(float) __pure2;
4088f3f7c66SDavid Schultz float	gammaf(float);
4098f3f7c66SDavid Schultz float	j0f(float);
4108f3f7c66SDavid Schultz float	j1f(float);
4118f3f7c66SDavid Schultz float	jnf(int, float);
4128f3f7c66SDavid Schultz float	scalbf(float, float);
4138f3f7c66SDavid Schultz float	y0f(float);
4148f3f7c66SDavid Schultz float	y1f(float);
4158f3f7c66SDavid Schultz float	ynf(int, float);
4163a8617a8SJordan K. Hubbard 
4173a8617a8SJordan K. Hubbard /*
4183a8617a8SJordan K. Hubbard  * Float versions of reentrant version of gamma & lgamma; passes
4193a8617a8SJordan K. Hubbard  * signgam back by reference as the second argument; user must
4203a8617a8SJordan K. Hubbard  * allocate space for signgam.
4213a8617a8SJordan K. Hubbard  */
42269160b1eSDavid E. O'Brien float	gammaf_r(float, int *);
42369160b1eSDavid E. O'Brien float	lgammaf_r(float, int *);
4248f3f7c66SDavid Schultz 
4258f3f7c66SDavid Schultz /*
4268f3f7c66SDavid Schultz  * float version of IEEE Test Vector
4278f3f7c66SDavid Schultz  */
4288f3f7c66SDavid Schultz float	significandf(float);
429457f6cd2SWarner Losh #endif	/* __BSD_VISIBLE */
4303a8617a8SJordan K. Hubbard 
43129bd23abSDag-Erling Smørgrav /*
43229bd23abSDag-Erling Smørgrav  * long double versions of ISO/POSIX math functions
43329bd23abSDag-Erling Smørgrav  */
4348f3f7c66SDavid Schultz #if __ISO_C_VISIBLE >= 1999
435998b640bSDavid Schultz long double	acoshl(long double);
43629bd23abSDag-Erling Smørgrav long double	acosl(long double);
437998b640bSDavid Schultz long double	asinhl(long double);
43829bd23abSDag-Erling Smørgrav long double	asinl(long double);
43929bd23abSDag-Erling Smørgrav long double	atan2l(long double, long double);
440998b640bSDavid Schultz long double	atanhl(long double);
44129bd23abSDag-Erling Smørgrav long double	atanl(long double);
44229bd23abSDag-Erling Smørgrav long double	cbrtl(long double);
44343295facSStefan Farfeleder long double	ceill(long double);
444b6e65225SDavid Schultz long double	copysignl(long double, long double) __pure2;
44529bd23abSDag-Erling Smørgrav long double	cosl(long double);
44629bd23abSDag-Erling Smørgrav long double	exp2l(long double);
447b83ccea3SSteve Kargl long double	expl(long double);
4483ffff4baSSteve Kargl long double	expm1l(long double);
449b6e65225SDavid Schultz long double	fabsl(long double) __pure2;
45029bd23abSDag-Erling Smørgrav long double	fdiml(long double, long double);
45129bd23abSDag-Erling Smørgrav long double	floorl(long double);
45229bd23abSDag-Erling Smørgrav long double	fmal(long double, long double, long double);
4534f82cb46SDavid Schultz long double	fmaxl(long double, long double) __pure2;
4544f82cb46SDavid Schultz long double	fminl(long double, long double) __pure2;
45529bd23abSDag-Erling Smørgrav long double	fmodl(long double, long double);
456b6e65225SDavid Schultz long double	frexpl(long double value, int *); /* fundamentally !__pure2 */
45729bd23abSDag-Erling Smørgrav long double	hypotl(long double, long double);
458b6e65225SDavid Schultz int		ilogbl(long double) __pure2;
45929bd23abSDag-Erling Smørgrav long double	ldexpl(long double, int);
460d3f9671aSDavid Schultz long long	llrintl(long double);
46129bd23abSDag-Erling Smørgrav long long	llroundl(long double);
46225a4d6bfSDavid Schultz long double	log10l(long double);
46325a4d6bfSDavid Schultz long double	log1pl(long double);
46425a4d6bfSDavid Schultz long double	log2l(long double);
46529bd23abSDag-Erling Smørgrav long double	logbl(long double);
46625a4d6bfSDavid Schultz long double	logl(long double);
467d3f9671aSDavid Schultz long		lrintl(long double);
46829bd23abSDag-Erling Smørgrav long		lroundl(long double);
469b6e65225SDavid Schultz long double	modfl(long double, long double *); /* fundamentally !__pure2 */
470b6e65225SDavid Schultz long double	nanl(const char *) __pure2;
47129bd23abSDag-Erling Smørgrav long double	nearbyintl(long double);
47229bd23abSDag-Erling Smørgrav long double	nextafterl(long double, long double);
47329bd23abSDag-Erling Smørgrav double		nexttoward(double, long double);
47429bd23abSDag-Erling Smørgrav float		nexttowardf(float, long double);
47529bd23abSDag-Erling Smørgrav long double	nexttowardl(long double, long double);
47629bd23abSDag-Erling Smørgrav long double	remainderl(long double, long double);
47729bd23abSDag-Erling Smørgrav long double	remquol(long double, long double, int *);
478d3f9671aSDavid Schultz long double	rintl(long double);
47907f3bc5bSDavid Schultz long double	roundl(long double);
48029bd23abSDag-Erling Smørgrav long double	scalblnl(long double, long);
48129bd23abSDag-Erling Smørgrav long double	scalbnl(long double, int);
48229bd23abSDag-Erling Smørgrav long double	sinl(long double);
48329bd23abSDag-Erling Smørgrav long double	sqrtl(long double);
48429bd23abSDag-Erling Smørgrav long double	tanl(long double);
4852f2ee27dSDavid Schultz long double	truncl(long double);
48629bd23abSDag-Erling Smørgrav 
4878f3f7c66SDavid Schultz #endif /* __ISO_C_VISIBLE >= 1999 */
4883a8617a8SJordan K. Hubbard __END_DECLS
4893a8617a8SJordan K. Hubbard 
490ef1ee63eSAlexey Zelkin #endif /* !_MATH_H_ */
4918f62d384SDavid Chisnall 
4928f62d384SDavid Chisnall /* separate header for cmath */
4938f62d384SDavid Chisnall #ifndef _MATH_EXTRA_H_
4948f62d384SDavid Chisnall #if __ISO_C_VISIBLE >= 1999
4958f62d384SDavid Chisnall #if _DECLARE_C99_LDBL_MATH
4968f62d384SDavid Chisnall 
4978f62d384SDavid Chisnall #define _MATH_EXTRA_H_
4988f62d384SDavid Chisnall 
4998f62d384SDavid Chisnall /*
5008f62d384SDavid Chisnall  * extra long double versions of math functions for C99 and cmath
5018f62d384SDavid Chisnall  */
5028f62d384SDavid Chisnall __BEGIN_DECLS
5038f62d384SDavid Chisnall 
5048f62d384SDavid Chisnall long double	coshl(long double);
5058f62d384SDavid Chisnall long double	erfcl(long double);
5068f62d384SDavid Chisnall long double	erfl(long double);
5078f62d384SDavid Chisnall long double	lgammal(long double);
5088f62d384SDavid Chisnall long double	powl(long double, long double);
5098f62d384SDavid Chisnall long double	sinhl(long double);
5108f62d384SDavid Chisnall long double	tanhl(long double);
5118f62d384SDavid Chisnall long double	tgammal(long double);
5128f62d384SDavid Chisnall 
5138f62d384SDavid Chisnall __END_DECLS
5148f62d384SDavid Chisnall 
5158f62d384SDavid Chisnall #endif /* !_DECLARE_C99_LDBL_MATH */
5168f62d384SDavid Chisnall #endif /* __ISO_C_VISIBLE >= 1999 */
5178f62d384SDavid Chisnall #endif /* !_MATH_EXTRA_H_ */
518