1 /* vi: set sw=4 ts=4: */
3 * Wrapper functions implementing all the long double math functions
4 * defined by SuSv3 by actually calling the double version of
5 * each function and then casting the result back to a long double
6 * to return to the user.
8 * Copyright (C) 2005 by Erik Andersen <andersen@uclibc.org>
10 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
14 /* Prevent math.h from defining colliding inlines */
15 #undef __USE_EXTERN_INLINES
19 #if !defined __NO_LONG_DOUBLE_MATH
20 # define WRAPPER1(func) \
21 long double func##l(long double x) \
23 return (long double) func((double) x); \
25 # define WRAPPER2(func) \
26 long double func##l(long double x, long double y) \
28 return (long double) func((double) x, (double) y); \
30 # define int_WRAPPER1(func) \
31 int func##l(long double x) \
33 return func((double) x); \
35 # define long_WRAPPER1(func) \
36 long func##l(long double x) \
38 return func((double) x); \
40 # define long_long_WRAPPER1(func) \
41 long long func##l(long double x) \
43 return func((double) x); \
46 #ifndef __DO_XSI_MATH__
47 # undef L_j0l /* long double j0l(long double x); */
48 # undef L_j1l /* long double j1l(long double x); */
49 # undef L_jnl /* long double jnl(int n, long double x); */
50 # undef L_y0l /* long double y0l(long double x); */
51 # undef L_y1l /* long double y1l(long double x); */
52 # undef L_ynl /* long double ynl(int n, long double x); */
55 /* Implement the following, as defined by SuSv3 */
57 long double acoshl(long double);
58 long double acosl(long double);
59 long double asinhl(long double);
60 long double asinl(long double);
61 long double atan2l(long double, long double);
62 long double atanhl(long double);
63 long double atanl(long double);
64 long double cargl(long double complex);
65 long double cbrtl(long double);
66 long double ceill(long double);
67 long double copysignl(long double, long double);
68 long double coshl(long double);
69 long double cosl(long double);
70 long double erfcl(long double);
71 long double erfl(long double);
72 long double exp2l(long double);
73 long double expl(long double);
74 long double expm1l(long double);
75 long double fabsl(long double);
76 long double fdiml(long double, long double);
77 long double floorl(long double);
78 long double fmal(long double, long double, long double);
79 long double fmaxl(long double, long double);
80 long double fminl(long double, long double);
81 long double fmodl(long double, long double);
82 long double frexpl(long double value
, int *);
83 long double hypotl(long double, long double);
84 int ilogbl(long double);
85 long double ldexpl(long double, int);
86 long double lgammal(long double);
87 long long llrintl(long double);
88 long long llroundl(long double);
89 long double log10l(long double);
90 long double log1pl(long double);
91 long double log2l(long double);
92 long double logbl(long double);
93 long double logl(long double);
94 long lrintl(long double);
95 long lroundl(long double);
96 long double modfl(long double, long double *);
97 long double nearbyintl(long double);
98 long double nextafterl(long double, long double);
99 long double nexttowardl(long double, long double);
100 long double powl(long double, long double);
101 long double remainderl(long double, long double);
102 long double remquol(long double, long double, int *);
103 long double rintl(long double);
104 long double roundl(long double);
105 long double scalblnl(long double, long);
106 long double scalbnl(long double, int);
107 long double sinhl(long double);
108 long double sinl(long double);
109 long double sqrtl(long double);
110 long double tanhl(long double);
111 long double tanl(long double);
112 long double tgammal(long double);
113 long double truncl(long double);
145 long double cargl (long double complex x
)
147 return (long double) carg( (double complex)x
);
169 libm_hidden_def(cosl
)
186 libm_hidden_def(expl
)
206 long double fmal (long double x
, long double y
, long double z
)
208 return (long double) fma( (double)x
, (double)y
, (double)z
);
225 long double frexpl (long double x
, int *ex
)
227 return (long double) frexp( (double)x
, ex
);
237 libm_hidden_def(hypotl
)
253 long double jnl(int n
, long double x
)
255 return (long double) jn(n
, (double)x
);
260 long double ldexpl (long double x
, int ex
)
262 return (long double) ldexp( (double)x
, ex
);
271 long_long_WRAPPER1(llrint
)
275 long_long_WRAPPER1(llround
)
303 long_WRAPPER1(lround
)
307 long double modfl (long double x
, long double *iptr
)
310 result
= modf ( x
, &y
);
311 *iptr
= (long double)y
;
312 return (long double) result
;
322 libm_hidden_def(nextafterl
)
327 strong_alias(nextafterl
, nexttowardl
)
329 long double nexttowardl(long double x
, long double y
)
331 return nextafterl(x
, y
);
345 long double remquol (long double x
, long double y
, int *quo
)
347 return (long double) remquo( (double)x
, (double)y
, quo
);
360 long double scalblnl (long double x
, long ex
)
362 return (long double) scalbln( (double)x
, ex
);
367 long double scalbnl (long double x
, int ex
)
369 return (long double) scalbn( (double)x
, ex
);
373 /* scalb is an obsolete function */
381 libm_hidden_def(sinl
)
404 #ifdef L_significandl
405 WRAPPER1(significand
)
417 long double ynl(int n
, long double x
)
419 return (long double) yn(n
, (double)x
);
424 #if defined __DO_C99_MATH__ && !defined __NO_LONG_DOUBLE_MATH
426 # ifdef L___fpclassifyl
427 int_WRAPPER1(__fpclassify
)
428 libm_hidden_def(__fpclassifyl
)
432 int_WRAPPER1(__finite
)
433 libm_hidden_def(__finitel
)
437 int_WRAPPER1(__signbit
)
438 libm_hidden_def(__signbitl
)
442 int_WRAPPER1(__isnan
)
443 libm_hidden_def(__isnanl
)
447 int_WRAPPER1(__isinf
)
448 libm_hidden_def(__isinfl
)
451 #endif /* __DO_C99_MATH__ */
453 #endif /* __NO_LONG_DOUBLE_MATH */