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 */
143a8617a8SJordan K. Hubbard
153a8617a8SJordan K. Hubbard #ifndef _MATH_H_
163a8617a8SJordan K. Hubbard #define _MATH_H_
173a8617a8SJordan K. Hubbard
188cf5ed51SMike Barcroft #include <sys/_types.h>
1983bc8931SStefan Farfeleder #include <machine/_limits.h>
208cf5ed51SMike Barcroft
213a8617a8SJordan K. Hubbard /*
223a8617a8SJordan K. Hubbard * ANSI/POSIX
233a8617a8SJordan K. Hubbard */
2483999f5aSArchie Cobbs extern const union __infinity_un {
2583999f5aSArchie Cobbs unsigned char __uc[8];
2683999f5aSArchie Cobbs double __ud;
2783999f5aSArchie Cobbs } __infinity;
288cf5ed51SMike Barcroft
298cf5ed51SMike Barcroft extern const union __nan_un {
308cf5ed51SMike Barcroft unsigned char __uc[sizeof(float)];
318cf5ed51SMike Barcroft float __uf;
328cf5ed51SMike Barcroft } __nan;
338cf5ed51SMike Barcroft
34b2d5d0b3SDavid Schultz #define __MATH_BUILTIN_CONSTANTS
35b2d5d0b3SDavid Schultz #define __MATH_BUILTIN_RELOPS
36b2d5d0b3SDavid Schultz
37b2d5d0b3SDavid Schultz #ifdef __MATH_BUILTIN_CONSTANTS
38b2d5d0b3SDavid Schultz #define HUGE_VAL __builtin_huge_val()
39b2d5d0b3SDavid Schultz #else
408f3f7c66SDavid Schultz #define HUGE_VAL (__infinity.__ud)
41b2d5d0b3SDavid Schultz #endif
428f3f7c66SDavid Schultz
438f3f7c66SDavid Schultz #if __ISO_C_VISIBLE >= 1999
4483bc8931SStefan Farfeleder #define FP_ILOGB0 (-__INT_MAX)
4583bc8931SStefan Farfeleder #define FP_ILOGBNAN __INT_MAX
46b2d5d0b3SDavid Schultz
47b2d5d0b3SDavid Schultz #ifdef __MATH_BUILTIN_CONSTANTS
48b2d5d0b3SDavid Schultz #define HUGE_VALF __builtin_huge_valf()
49b2d5d0b3SDavid Schultz #define HUGE_VALL __builtin_huge_vall()
504984f138SDavid Schultz #define INFINITY __builtin_inff()
514984f138SDavid Schultz #define NAN __builtin_nanf("")
52b2d5d0b3SDavid Schultz #else
538cf5ed51SMike Barcroft #define HUGE_VALF (float)HUGE_VAL
548cf5ed51SMike Barcroft #define HUGE_VALL (long double)HUGE_VAL
558cf5ed51SMike Barcroft #define INFINITY HUGE_VALF
568cf5ed51SMike Barcroft #define NAN (__nan.__uf)
57b2d5d0b3SDavid Schultz #endif /* __MATH_BUILTIN_CONSTANTS */
588cf5ed51SMike Barcroft
596eb2d83eSBruce Evans #define MATH_ERRNO 1
606eb2d83eSBruce Evans #define MATH_ERREXCEPT 2
61ce4e53c4SDavid Schultz #define math_errhandling MATH_ERREXCEPT
626eb2d83eSBruce Evans
6315d5d9deSDavid Schultz #define FP_FAST_FMAF 1
64d5580d09SDavid Schultz
658cf5ed51SMike Barcroft /* Symbolic constants to classify floating point numbers. */
665d62092fSMike Barcroft #define FP_INFINITE 0x01
675d62092fSMike Barcroft #define FP_NAN 0x02
685d62092fSMike Barcroft #define FP_NORMAL 0x04
695d62092fSMike Barcroft #define FP_SUBNORMAL 0x08
705d62092fSMike Barcroft #define FP_ZERO 0x10
715d62092fSMike Barcroft
727702d940SDimitry Andric #if __STDC_VERSION__ >= 201112L || __has_extension(c_generic_selections)
737702d940SDimitry Andric #define __fp_type_select(x, f, d, ld) __extension__ _Generic((x), \
744309f9f2SMartin Oliveira float: f, \
754309f9f2SMartin Oliveira double: d, \
764309f9f2SMartin Oliveira long double: ld)(x)
77*fa1e8538SWarner Losh #elif !defined(__cplusplus)
78a3fc79deSDavid Chisnall #define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \
79a3fc79deSDavid Chisnall __builtin_types_compatible_p(__typeof(x), long double), ld(x), \
80a3fc79deSDavid Chisnall __builtin_choose_expr( \
81a3fc79deSDavid Chisnall __builtin_types_compatible_p(__typeof(x), double), d(x), \
82a3fc79deSDavid Chisnall __builtin_choose_expr( \
83a3fc79deSDavid Chisnall __builtin_types_compatible_p(__typeof(x), float), f(x), (void)0)))
84a3fc79deSDavid Chisnall #else
85a3fc79deSDavid Chisnall #define __fp_type_select(x, f, d, ld) \
86a3fc79deSDavid Chisnall ((sizeof(x) == sizeof(float)) ? f(x) \
87a3fc79deSDavid Chisnall : (sizeof(x) == sizeof(double)) ? d(x) \
88a3fc79deSDavid Chisnall : ld(x))
89a3fc79deSDavid Chisnall #endif
90a3fc79deSDavid Chisnall
91a3fc79deSDavid Chisnall #define fpclassify(x) \
9295f82796SDavid Chisnall __fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyl)
93a3fc79deSDavid Chisnall #define isfinite(x) __fp_type_select(x, __isfinitef, __isfinite, __isfinitel)
94a3fc79deSDavid Chisnall #define isinf(x) __fp_type_select(x, __isinff, __isinf, __isinfl)
95240dbabfSDavid Schultz #define isnan(x) \
96a3fc79deSDavid Chisnall __fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl)
97a3fc79deSDavid Chisnall #define isnormal(x) __fp_type_select(x, __isnormalf, __isnormal, __isnormall)
985d62092fSMike Barcroft
99b2d5d0b3SDavid Schultz #ifdef __MATH_BUILTIN_RELOPS
100b2d5d0b3SDavid Schultz #define isgreater(x, y) __builtin_isgreater((x), (y))
101b2d5d0b3SDavid Schultz #define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y))
102b2d5d0b3SDavid Schultz #define isless(x, y) __builtin_isless((x), (y))
103b2d5d0b3SDavid Schultz #define islessequal(x, y) __builtin_islessequal((x), (y))
104b2d5d0b3SDavid Schultz #define islessgreater(x, y) __builtin_islessgreater((x), (y))
105b2d5d0b3SDavid Schultz #define isunordered(x, y) __builtin_isunordered((x), (y))
106b2d5d0b3SDavid Schultz #else
1075d62092fSMike Barcroft #define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y))
1085d62092fSMike Barcroft #define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y))
1095d62092fSMike Barcroft #define isless(x, y) (!isunordered((x), (y)) && (x) < (y))
1105d62092fSMike Barcroft #define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y))
1115d62092fSMike Barcroft #define islessgreater(x, y) (!isunordered((x), (y)) && \
1125d62092fSMike Barcroft ((x) > (y) || (y) > (x)))
1135d62092fSMike Barcroft #define isunordered(x, y) (isnan(x) || isnan(y))
114b2d5d0b3SDavid Schultz #endif /* __MATH_BUILTIN_RELOPS */
1155d62092fSMike Barcroft
116a3fc79deSDavid Chisnall #define signbit(x) __fp_type_select(x, __signbitf, __signbit, __signbitl)
1178cf5ed51SMike Barcroft
1188cf5ed51SMike Barcroft typedef __double_t double_t;
1198cf5ed51SMike Barcroft typedef __float_t float_t;
1208f3f7c66SDavid Schultz #endif /* __ISO_C_VISIBLE >= 1999 */
1213a8617a8SJordan K. Hubbard
1223a8617a8SJordan K. Hubbard /*
1233a8617a8SJordan K. Hubbard * XOPEN/SVID
1243a8617a8SJordan K. Hubbard */
1258f3f7c66SDavid Schultz #if __BSD_VISIBLE || __XSI_VISIBLE
1263a8617a8SJordan K. Hubbard #define M_E 2.7182818284590452354 /* e */
1273a8617a8SJordan K. Hubbard #define M_LOG2E 1.4426950408889634074 /* log 2e */
1283a8617a8SJordan K. Hubbard #define M_LOG10E 0.43429448190325182765 /* log 10e */
1293a8617a8SJordan K. Hubbard #define M_LN2 0.69314718055994530942 /* log e2 */
1303a8617a8SJordan K. Hubbard #define M_LN10 2.30258509299404568402 /* log e10 */
1313a8617a8SJordan K. Hubbard #define M_PI 3.14159265358979323846 /* pi */
1323a8617a8SJordan K. Hubbard #define M_PI_2 1.57079632679489661923 /* pi/2 */
1333a8617a8SJordan K. Hubbard #define M_PI_4 0.78539816339744830962 /* pi/4 */
1343a8617a8SJordan K. Hubbard #define M_1_PI 0.31830988618379067154 /* 1/pi */
1353a8617a8SJordan K. Hubbard #define M_2_PI 0.63661977236758134308 /* 2/pi */
1363a8617a8SJordan K. Hubbard #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
1373a8617a8SJordan K. Hubbard #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
1383a8617a8SJordan K. Hubbard #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
1393a8617a8SJordan K. Hubbard
14022ddb5bbSCollin Funk #if __BSD_VISIBLE || __XSI_VISIBLE >= 800
14122ddb5bbSCollin Funk #define M_El 2.718281828459045235360287471352662498L /* e */
14222ddb5bbSCollin Funk #define M_LOG2El 1.442695040888963407359924681001892137L /* log_2 e */
14322ddb5bbSCollin Funk #define M_LOG10El 0.434294481903251827651128918916605082L /* log_10 e */
14422ddb5bbSCollin Funk #define M_LN2l 0.693147180559945309417232121458176568L /* log_e 2 */
14522ddb5bbSCollin Funk #define M_LN10l 2.302585092994045684017991454684364208L /* log_e 10 */
14622ddb5bbSCollin Funk #define M_PIl 3.141592653589793238462643383279502884L /* pi */
14722ddb5bbSCollin Funk #define M_PI_2l 1.570796326794896619231321691639751442L /* pi/2 */
14822ddb5bbSCollin Funk #define M_PI_4l 0.785398163397448309615660845819875721L /* pi/4 */
14922ddb5bbSCollin Funk #define M_1_PIl 0.318309886183790671537767526745028724L /* 1/pi */
15022ddb5bbSCollin Funk #define M_2_PIl 0.636619772367581343075535053490057448L /* 2/pi */
15122ddb5bbSCollin Funk #define M_2_SQRTPIl 1.128379167095512573896158903121545172L /* 2/sqrt(pi) */
15222ddb5bbSCollin Funk #define M_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */
15322ddb5bbSCollin Funk #define M_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */
15422ddb5bbSCollin Funk #endif /* __BSD_VISIBLE || __XSI_VISIBLE >= 800 */
15522ddb5bbSCollin Funk
1563a8617a8SJordan K. Hubbard #define MAXFLOAT ((float)3.40282346638528860e+38)
1573a8617a8SJordan K. Hubbard extern int signgam;
1588f3f7c66SDavid Schultz #endif /* __BSD_VISIBLE || __XSI_VISIBLE */
1593a8617a8SJordan K. Hubbard
1608f3f7c66SDavid Schultz #if __BSD_VISIBLE
16171936f35SDavid Schultz #if 0
16271936f35SDavid Schultz /* Old value from 4.4BSD-Lite math.h; this is probably better. */
16371936f35SDavid Schultz #define HUGE HUGE_VAL
16471936f35SDavid Schultz #else
16571936f35SDavid Schultz #define HUGE MAXFLOAT
16671936f35SDavid Schultz #endif
1678f3f7c66SDavid Schultz #endif /* __BSD_VISIBLE */
1683a8617a8SJordan K. Hubbard
169219cbe10SBruce Evans /*
170b6e65225SDavid Schultz * Most of these functions depend on the rounding mode and have the side
171b6e65225SDavid Schultz * effect of raising floating-point exceptions, so they are not declared
172b6e65225SDavid Schultz * as __pure2. In C99, FENV_ACCESS affects the purity of these functions.
173219cbe10SBruce Evans */
1746898f8c4SBruce Evans __BEGIN_DECLS
1753a8617a8SJordan K. Hubbard /*
1763a8617a8SJordan K. Hubbard * ANSI/POSIX
1773a8617a8SJordan K. Hubbard */
1785d62092fSMike Barcroft int __fpclassifyd(double) __pure2;
1795d62092fSMike Barcroft int __fpclassifyf(float) __pure2;
1805d62092fSMike Barcroft int __fpclassifyl(long double) __pure2;
181240dbabfSDavid Schultz int __isfinitef(float) __pure2;
182240dbabfSDavid Schultz int __isfinite(double) __pure2;
183240dbabfSDavid Schultz int __isfinitel(long double) __pure2;
184240dbabfSDavid Schultz int __isinff(float) __pure2;
185a3fc79deSDavid Chisnall int __isinf(double) __pure2;
186240dbabfSDavid Schultz int __isinfl(long double) __pure2;
187240dbabfSDavid Schultz int __isnormalf(float) __pure2;
188240dbabfSDavid Schultz int __isnormal(double) __pure2;
189240dbabfSDavid Schultz int __isnormall(long double) __pure2;
1905d62092fSMike Barcroft int __signbit(double) __pure2;
191ec79bc0dSDavid Schultz int __signbitf(float) __pure2;
192ec79bc0dSDavid Schultz int __signbitl(long double) __pure2;
1938cf5ed51SMike Barcroft
194a3fc79deSDavid Chisnall static __inline int
__inline_isnan(const double __x)1951b681154SWarner Losh __inline_isnan(const double __x)
196a3fc79deSDavid Chisnall {
197a3fc79deSDavid Chisnall
198a3fc79deSDavid Chisnall return (__x != __x);
199a3fc79deSDavid Chisnall }
200a3fc79deSDavid Chisnall
201a3fc79deSDavid Chisnall static __inline int
__inline_isnanf(const float __x)2021b681154SWarner Losh __inline_isnanf(const float __x)
203a3fc79deSDavid Chisnall {
204a3fc79deSDavid Chisnall
205a3fc79deSDavid Chisnall return (__x != __x);
206a3fc79deSDavid Chisnall }
207a3fc79deSDavid Chisnall
208a3fc79deSDavid Chisnall static __inline int
__inline_isnanl(const long double __x)2091b681154SWarner Losh __inline_isnanl(const long double __x)
210a3fc79deSDavid Chisnall {
211a3fc79deSDavid Chisnall
212a3fc79deSDavid Chisnall return (__x != __x);
213a3fc79deSDavid Chisnall }
214a3fc79deSDavid Chisnall
2156b69e627SDavid Chisnall /*
216f68ff1acSDimitry Andric * Define the following aliases, for compatibility with glibc and CUDA.
217f68ff1acSDimitry Andric */
218f68ff1acSDimitry Andric #define __isnan __inline_isnan
219f68ff1acSDimitry Andric #define __isnanf __inline_isnanf
220f68ff1acSDimitry Andric
221f68ff1acSDimitry Andric /*
2226b69e627SDavid Chisnall * Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and
2236b69e627SDavid Chisnall * isinf() as functions taking double. C99, and the subsequent POSIX revisions
2246b69e627SDavid Chisnall * (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating
2256b69e627SDavid Chisnall * point type. If we are targeting SUSv2 and C99 or C11 (or C++11) then we
2266b69e627SDavid Chisnall * expose the newer definition, assuming that the language spec takes
2276b69e627SDavid Chisnall * precedence over the operating system interface spec.
2286b69e627SDavid Chisnall */
2296b69e627SDavid Chisnall #if __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 && __ISO_C_VISIBLE < 1999
2306b69e627SDavid Chisnall #undef isinf
2316b69e627SDavid Chisnall #undef isnan
2326b69e627SDavid Chisnall int isinf(double);
2336b69e627SDavid Chisnall int isnan(double);
2346b69e627SDavid Chisnall #endif
2356b69e627SDavid Chisnall
23669160b1eSDavid E. O'Brien double acos(double);
23769160b1eSDavid E. O'Brien double asin(double);
23869160b1eSDavid E. O'Brien double atan(double);
23969160b1eSDavid E. O'Brien double atan2(double, double);
24069160b1eSDavid E. O'Brien double cos(double);
24169160b1eSDavid E. O'Brien double sin(double);
24269160b1eSDavid E. O'Brien double tan(double);
2433a8617a8SJordan K. Hubbard
24469160b1eSDavid E. O'Brien double cosh(double);
24569160b1eSDavid E. O'Brien double sinh(double);
24669160b1eSDavid E. O'Brien double tanh(double);
2473a8617a8SJordan K. Hubbard
24869160b1eSDavid E. O'Brien double exp(double);
249219cbe10SBruce Evans double frexp(double, int *); /* fundamentally !__pure2 */
25069160b1eSDavid E. O'Brien double ldexp(double, int);
25169160b1eSDavid E. O'Brien double log(double);
25269160b1eSDavid E. O'Brien double log10(double);
253219cbe10SBruce Evans double modf(double, double *); /* fundamentally !__pure2 */
2543a8617a8SJordan K. Hubbard
25569160b1eSDavid E. O'Brien double pow(double, double);
25669160b1eSDavid E. O'Brien double sqrt(double);
2573a8617a8SJordan K. Hubbard
25869160b1eSDavid E. O'Brien double ceil(double);
259b6e65225SDavid Schultz double fabs(double) __pure2;
26069160b1eSDavid E. O'Brien double floor(double);
26169160b1eSDavid E. O'Brien double fmod(double, double);
2623a8617a8SJordan K. Hubbard
263219cbe10SBruce Evans /*
264b6e65225SDavid Schultz * These functions are not in C90.
265219cbe10SBruce Evans */
2668f3f7c66SDavid Schultz #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE
26769160b1eSDavid E. O'Brien double acosh(double);
26869160b1eSDavid E. O'Brien double asinh(double);
26969160b1eSDavid E. O'Brien double atanh(double);
270b6e65225SDavid Schultz double cbrt(double);
2718f3f7c66SDavid Schultz double erf(double);
272b6e65225SDavid Schultz double erfc(double);
273f8d6ede6SDavid Schultz double exp2(double);
274b6e65225SDavid Schultz double expm1(double);
27521122beaSDavid Schultz double fma(double, double, double);
2768f3f7c66SDavid Schultz double hypot(double, double);
277b6e65225SDavid Schultz int ilogb(double) __pure2;
2788f3f7c66SDavid Schultz double lgamma(double);
27910c9ffa4SDavid Schultz long long llrint(double);
28010c9ffa4SDavid Schultz long long llround(double);
281b6e65225SDavid Schultz double log1p(double);
282177668d1SDavid Schultz double log2(double);
283b6e65225SDavid Schultz double logb(double);
28410c9ffa4SDavid Schultz long lrint(double);
28510c9ffa4SDavid Schultz long lround(double);
2864b6b5744SDavid Schultz double nan(const char *) __pure2;
28769160b1eSDavid E. O'Brien double nextafter(double, double);
28869160b1eSDavid E. O'Brien double remainder(double, double);
2893b9141eeSDavid Schultz double remquo(double, double, int *);
290b6e65225SDavid Schultz double rint(double);
2918f3f7c66SDavid Schultz #endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
2923a8617a8SJordan K. Hubbard
2938f3f7c66SDavid Schultz #if __BSD_VISIBLE || __XSI_VISIBLE
2948f3f7c66SDavid Schultz double j0(double);
2958f3f7c66SDavid Schultz double j1(double);
2968f3f7c66SDavid Schultz double jn(int, double);
2978f3f7c66SDavid Schultz double y0(double);
2988f3f7c66SDavid Schultz double y1(double);
2998f3f7c66SDavid Schultz double yn(int, double);
3008f3f7c66SDavid Schultz
3018f3f7c66SDavid Schultz #if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
3028f3f7c66SDavid Schultz double gamma(double);
3036a9280beSBruce Evans #endif
304fbaabc11SDavid Schultz
305fbaabc11SDavid Schultz #if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
306fbaabc11SDavid Schultz double scalb(double, double);
307fbaabc11SDavid Schultz #endif
3088f3f7c66SDavid Schultz #endif /* __BSD_VISIBLE || __XSI_VISIBLE */
3098f3f7c66SDavid Schultz
3108f3f7c66SDavid Schultz #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
3118f3f7c66SDavid Schultz double copysign(double, double) __pure2;
3129979bae3SStefan Farfeleder double fdim(double, double);
3139979bae3SStefan Farfeleder double fmax(double, double) __pure2;
3149979bae3SStefan Farfeleder double fmin(double, double) __pure2;
315b6e65225SDavid Schultz double nearbyint(double);
3169979bae3SStefan Farfeleder double round(double);
31762247e90SDavid Schultz double scalbln(double, long);
3188f3f7c66SDavid Schultz double scalbn(double, int);
3198f3f7c66SDavid Schultz double tgamma(double);
3209979bae3SStefan Farfeleder double trunc(double);
3218f3f7c66SDavid Schultz #endif
3228f3f7c66SDavid Schultz
3238f3f7c66SDavid Schultz /*
3248f3f7c66SDavid Schultz * BSD math library entry points
3258f3f7c66SDavid Schultz */
3268f3f7c66SDavid Schultz #if __BSD_VISIBLE
3278f3f7c66SDavid Schultz double drem(double, double);
3288f3f7c66SDavid Schultz int finite(double) __pure2;
329240dbabfSDavid Schultz int isnanf(float) __pure2;
3308f3f7c66SDavid Schultz
3318f3f7c66SDavid Schultz /*
3328f3f7c66SDavid Schultz * Reentrant version of gamma & lgamma; passes signgam back by reference
3338f3f7c66SDavid Schultz * as the second argument; user must allocate space for signgam.
3348f3f7c66SDavid Schultz */
3358f3f7c66SDavid Schultz double gamma_r(double, int *);
3368f3f7c66SDavid Schultz double lgamma_r(double, int *);
3373a8617a8SJordan K. Hubbard
3383a8617a8SJordan K. Hubbard /*
3393a8617a8SJordan K. Hubbard * IEEE Test Vector
3403a8617a8SJordan K. Hubbard */
34169160b1eSDavid E. O'Brien double significand(double);
342457f6cd2SWarner Losh #endif /* __BSD_VISIBLE */
3433a8617a8SJordan K. Hubbard
3443a8617a8SJordan K. Hubbard /* float versions of ANSI/POSIX functions */
3458f3f7c66SDavid Schultz #if __ISO_C_VISIBLE >= 1999
34669160b1eSDavid E. O'Brien float acosf(float);
34769160b1eSDavid E. O'Brien float asinf(float);
34869160b1eSDavid E. O'Brien float atanf(float);
34969160b1eSDavid E. O'Brien float atan2f(float, float);
35069160b1eSDavid E. O'Brien float cosf(float);
35169160b1eSDavid E. O'Brien float sinf(float);
35269160b1eSDavid E. O'Brien float tanf(float);
3533a8617a8SJordan K. Hubbard
35469160b1eSDavid E. O'Brien float coshf(float);
35569160b1eSDavid E. O'Brien float sinhf(float);
35669160b1eSDavid E. O'Brien float tanhf(float);
3573a8617a8SJordan K. Hubbard
358f8d6ede6SDavid Schultz float exp2f(float);
35969160b1eSDavid E. O'Brien float expf(float);
360b6e65225SDavid Schultz float expm1f(float);
361219cbe10SBruce Evans float frexpf(float, int *); /* fundamentally !__pure2 */
362b6e65225SDavid Schultz int ilogbf(float) __pure2;
36369160b1eSDavid E. O'Brien float ldexpf(float, int);
36469160b1eSDavid E. O'Brien float log10f(float);
365b6e65225SDavid Schultz float log1pf(float);
366177668d1SDavid Schultz float log2f(float);
3678f3f7c66SDavid Schultz float logf(float);
368219cbe10SBruce Evans float modff(float, float *); /* fundamentally !__pure2 */
3693a8617a8SJordan K. Hubbard
37069160b1eSDavid E. O'Brien float powf(float, float);
37169160b1eSDavid E. O'Brien float sqrtf(float);
3723a8617a8SJordan K. Hubbard
37369160b1eSDavid E. O'Brien float ceilf(float);
374b6e65225SDavid Schultz float fabsf(float) __pure2;
37569160b1eSDavid E. O'Brien float floorf(float);
37669160b1eSDavid E. O'Brien float fmodf(float, float);
377d0f13633SDavid Schultz float roundf(float);
3783a8617a8SJordan K. Hubbard
37969160b1eSDavid E. O'Brien float erff(float);
380b6e65225SDavid Schultz float erfcf(float);
381b6e65225SDavid Schultz float hypotf(float, float);
38269160b1eSDavid E. O'Brien float lgammaf(float);
38371c11dd5SDavid Schultz float tgammaf(float);
3843a8617a8SJordan K. Hubbard
38569160b1eSDavid E. O'Brien float acoshf(float);
38669160b1eSDavid E. O'Brien float asinhf(float);
38769160b1eSDavid E. O'Brien float atanhf(float);
388b6e65225SDavid Schultz float cbrtf(float);
389b6e65225SDavid Schultz float logbf(float);
3908f3f7c66SDavid Schultz float copysignf(float, float) __pure2;
39110c9ffa4SDavid Schultz long long llrintf(float);
39210c9ffa4SDavid Schultz long long llroundf(float);
39310c9ffa4SDavid Schultz long lrintf(float);
39410c9ffa4SDavid Schultz long lroundf(float);
3954b6b5744SDavid Schultz float nanf(const char *) __pure2;
396b6e65225SDavid Schultz float nearbyintf(float);
39769160b1eSDavid E. O'Brien float nextafterf(float, float);
39869160b1eSDavid E. O'Brien float remainderf(float, float);
3993b9141eeSDavid Schultz float remquof(float, float, int *);
40069160b1eSDavid E. O'Brien float rintf(float);
40162247e90SDavid Schultz float scalblnf(float, long);
40269160b1eSDavid E. O'Brien float scalbnf(float, int);
40362247e90SDavid Schultz float truncf(float);
4044f82cb46SDavid Schultz
4054f82cb46SDavid Schultz float fdimf(float, float);
40621122beaSDavid Schultz float fmaf(float, float, float);
4074f82cb46SDavid Schultz float fmaxf(float, float) __pure2;
4084f82cb46SDavid Schultz float fminf(float, float) __pure2;
4098f3f7c66SDavid Schultz #endif
4103a8617a8SJordan K. Hubbard
4113a8617a8SJordan K. Hubbard /*
4123a8617a8SJordan K. Hubbard * float versions of BSD math library entry points
4133a8617a8SJordan K. Hubbard */
4148f3f7c66SDavid Schultz #if __BSD_VISIBLE
41569160b1eSDavid E. O'Brien float dremf(float, float);
4168f3f7c66SDavid Schultz int finitef(float) __pure2;
4178f3f7c66SDavid Schultz float gammaf(float);
4188f3f7c66SDavid Schultz float j0f(float);
4198f3f7c66SDavid Schultz float j1f(float);
4208f3f7c66SDavid Schultz float jnf(int, float);
4218f3f7c66SDavid Schultz float scalbf(float, float);
4228f3f7c66SDavid Schultz float y0f(float);
4238f3f7c66SDavid Schultz float y1f(float);
4248f3f7c66SDavid Schultz float ynf(int, float);
4253a8617a8SJordan K. Hubbard
4263a8617a8SJordan K. Hubbard /*
4273a8617a8SJordan K. Hubbard * Float versions of reentrant version of gamma & lgamma; passes
4283a8617a8SJordan K. Hubbard * signgam back by reference as the second argument; user must
4293a8617a8SJordan K. Hubbard * allocate space for signgam.
4303a8617a8SJordan K. Hubbard */
43169160b1eSDavid E. O'Brien float gammaf_r(float, int *);
43269160b1eSDavid E. O'Brien float lgammaf_r(float, int *);
4338f3f7c66SDavid Schultz
4348f3f7c66SDavid Schultz /*
4358f3f7c66SDavid Schultz * float version of IEEE Test Vector
4368f3f7c66SDavid Schultz */
4378f3f7c66SDavid Schultz float significandf(float);
438457f6cd2SWarner Losh #endif /* __BSD_VISIBLE */
4393a8617a8SJordan K. Hubbard
44029bd23abSDag-Erling Smørgrav /*
44129bd23abSDag-Erling Smørgrav * long double versions of ISO/POSIX math functions
44229bd23abSDag-Erling Smørgrav */
4438f3f7c66SDavid Schultz #if __ISO_C_VISIBLE >= 1999
444998b640bSDavid Schultz long double acoshl(long double);
44529bd23abSDag-Erling Smørgrav long double acosl(long double);
446998b640bSDavid Schultz long double asinhl(long double);
44729bd23abSDag-Erling Smørgrav long double asinl(long double);
44829bd23abSDag-Erling Smørgrav long double atan2l(long double, long double);
449998b640bSDavid Schultz long double atanhl(long double);
45029bd23abSDag-Erling Smørgrav long double atanl(long double);
45129bd23abSDag-Erling Smørgrav long double cbrtl(long double);
45243295facSStefan Farfeleder long double ceill(long double);
453b6e65225SDavid Schultz long double copysignl(long double, long double) __pure2;
454a48e1f22SSteve Kargl long double coshl(long double);
45529bd23abSDag-Erling Smørgrav long double cosl(long double);
4563b5e0d0fSSteve Kargl long double erfcl(long double);
4573b5e0d0fSSteve Kargl long double erfl(long double);
45829bd23abSDag-Erling Smørgrav long double exp2l(long double);
459b83ccea3SSteve Kargl long double expl(long double);
4603ffff4baSSteve Kargl long double expm1l(long double);
461b6e65225SDavid Schultz long double fabsl(long double) __pure2;
46229bd23abSDag-Erling Smørgrav long double fdiml(long double, long double);
46329bd23abSDag-Erling Smørgrav long double floorl(long double);
46429bd23abSDag-Erling Smørgrav long double fmal(long double, long double, long double);
4654f82cb46SDavid Schultz long double fmaxl(long double, long double) __pure2;
4664f82cb46SDavid Schultz long double fminl(long double, long double) __pure2;
46729bd23abSDag-Erling Smørgrav long double fmodl(long double, long double);
468b8f41779SEdward Tomasz Napierala long double frexpl(long double, int *); /* fundamentally !__pure2 */
46929bd23abSDag-Erling Smørgrav long double hypotl(long double, long double);
470b6e65225SDavid Schultz int ilogbl(long double) __pure2;
47129bd23abSDag-Erling Smørgrav long double ldexpl(long double, int);
47255ad7cd7SSteve Kargl long double lgammal(long double);
473d3f9671aSDavid Schultz long long llrintl(long double);
47429bd23abSDag-Erling Smørgrav long long llroundl(long double);
47525a4d6bfSDavid Schultz long double log10l(long double);
47625a4d6bfSDavid Schultz long double log1pl(long double);
47725a4d6bfSDavid Schultz long double log2l(long double);
47829bd23abSDag-Erling Smørgrav long double logbl(long double);
47925a4d6bfSDavid Schultz long double logl(long double);
480d3f9671aSDavid Schultz long lrintl(long double);
48129bd23abSDag-Erling Smørgrav long lroundl(long double);
482b6e65225SDavid Schultz long double modfl(long double, long double *); /* fundamentally !__pure2 */
483b6e65225SDavid Schultz long double nanl(const char *) __pure2;
48429bd23abSDag-Erling Smørgrav long double nearbyintl(long double);
48529bd23abSDag-Erling Smørgrav long double nextafterl(long double, long double);
48629bd23abSDag-Erling Smørgrav double nexttoward(double, long double);
48729bd23abSDag-Erling Smørgrav float nexttowardf(float, long double);
48829bd23abSDag-Erling Smørgrav long double nexttowardl(long double, long double);
48955ad7cd7SSteve Kargl long double powl(long double, long double);
49029bd23abSDag-Erling Smørgrav long double remainderl(long double, long double);
49129bd23abSDag-Erling Smørgrav long double remquol(long double, long double, int *);
492d3f9671aSDavid Schultz long double rintl(long double);
49307f3bc5bSDavid Schultz long double roundl(long double);
49429bd23abSDag-Erling Smørgrav long double scalblnl(long double, long);
49529bd23abSDag-Erling Smørgrav long double scalbnl(long double, int);
496a48e1f22SSteve Kargl long double sinhl(long double);
49729bd23abSDag-Erling Smørgrav long double sinl(long double);
49829bd23abSDag-Erling Smørgrav long double sqrtl(long double);
499a48e1f22SSteve Kargl long double tanhl(long double);
50029bd23abSDag-Erling Smørgrav long double tanl(long double);
50155ad7cd7SSteve Kargl long double tgammal(long double);
5022f2ee27dSDavid Schultz long double truncl(long double);
5038f3f7c66SDavid Schultz #endif /* __ISO_C_VISIBLE >= 1999 */
504f7efd14dSSteve Kargl
505f7efd14dSSteve Kargl #if __BSD_VISIBLE
506f7efd14dSSteve Kargl long double lgammal_r(long double, int *);
507e1b98d07SMichal Meloun void sincos(double, double *, double *);
508e1b98d07SMichal Meloun void sincosf(float, float *, float *);
509e1b98d07SMichal Meloun void sincosl(long double, long double *, long double *);
510dce5f3abSSteve Kargl double cospi(double);
511dce5f3abSSteve Kargl float cospif(float);
512dce5f3abSSteve Kargl long double cospil(long double);
513dce5f3abSSteve Kargl double sinpi(double);
514dce5f3abSSteve Kargl float sinpif(float);
515dce5f3abSSteve Kargl long double sinpil(long double);
516dce5f3abSSteve Kargl double tanpi(double);
517dce5f3abSSteve Kargl float tanpif(float);
518dce5f3abSSteve Kargl long double tanpil(long double);
519f7efd14dSSteve Kargl #endif
520f7efd14dSSteve Kargl
5213a8617a8SJordan K. Hubbard __END_DECLS
5223a8617a8SJordan K. Hubbard
523ef1ee63eSAlexey Zelkin #endif /* !_MATH_H_ */
524