1 /* vi: set sw=4 ts=4: */
3 * Wrapper functions implementing all the float math functions
4 * defined by SuSv3 by actually calling the double version of
5 * each function and then casting the result back to a float
6 * to return to the user.
8 * Copyright (C) 2005 by Erik Andersen <andersen@uclibc.org>
10 * GNU Lesser General Public License version 2.1 or later.
14 /* Prevent math.h from defining colliding inlines */
15 #undef __USE_EXTERN_INLINES
20 #define WRAPPER1(func) \
21 float func##f (float x) \
23 return (float) func((double)x); \
25 #define int_WRAPPER1(func) \
26 int func##f (float x) \
28 return func((double)x); \
30 #define long_WRAPPER1(func) \
31 long func##f (float x) \
33 return func((double)x); \
35 #define long_long_WRAPPER1(func) \
36 long long func##f (float x) \
38 return func((double)x); \
41 #ifndef __DO_XSI_MATH__
42 # undef L_j0f /* float j0f(float x); */
43 # undef L_j1f /* float j1f(float x); */
44 # undef L_jnf /* float jnf(int n, float x); */
45 # undef L_y0f /* float y0f(float x); */
46 # undef L_y1f /* float y1f(float x); */
47 # undef L_ynf /* float ynf(int n, float x); */
50 /* Implement the following, as defined by SuSv3 */
56 float atan2f(float, float);
59 float cargf(float complex);
62 float copysignf(float, float);
72 float fmodf(float, float);
73 float frexpf(float value
, int *);
74 float hypotf(float, float);
76 float ldexpf(float, int);
78 long long llroundf(float);
85 float modff(float, float *);
86 float powf(float, float);
87 float remainderf(float, float);
90 float scalbnf(float, int);
115 float atan2f (float x
, float y
)
117 return (float) atan2( (double)x
, (double)y
);
130 float cargf (float complex x
)
132 return (float) carg( (double complex)x
);
145 float copysignf (float x
, float y
)
147 return (float) copysign( (double)x
, (double)y
);
153 libm_hidden_def(cosf
)
185 float fdimf (float x
, float y
)
187 return (float) fdim( (double)x
, (double)y
);
196 float fmaf (float x
, float y
, float z
)
198 return (float) fma( (double)x
, (double)y
, (double)z
);
203 float fmaxf (float x
, float y
)
205 return (float) fmax( (double)x
, (double)y
);
210 float fminf (float x
, float y
)
212 return (float) fmin( (double)x
, (double)y
);
217 float fmodf (float x
, float y
)
219 return (float) fmod( (double)x
, (double)y
);
224 float frexpf (float x
, int *_exp
)
226 return (float) frexp( (double)x
, _exp
);
231 float hypotf (float x
, float y
)
233 return (float) hypot( (double)x
, (double)y
);
250 float jnf(int n
, float x
)
252 return (float) jn(n
, (double)x
);
257 float ldexpf (float x
, int _exp
)
259 return (float) ldexp( (double)x
, _exp
);
268 long_long_WRAPPER1(llrint
)
272 long_long_WRAPPER1(llround
)
300 long_WRAPPER1(lround
)
304 float modff (float x
, float *iptr
)
307 result
= modf( x
, &y
);
309 return (float) result
;
318 float nexttowardf (float x
, long double y
)
320 return (float) nexttoward( (double)x
, (long double)y
);
325 float powf (float x
, float y
)
327 return (float) pow( (double)x
, (double)y
);
332 float remainderf (float x
, float y
)
334 return (float) remainder( (double)x
, (double)y
);
339 float remquof (float x
, float y
, int *quo
)
341 return (float) remquo( (double)x
, (double)y
, quo
);
354 float scalblnf (float x
, long _exp
)
356 return (float) scalbln( (double)x
, _exp
);
361 float scalbnf (float x
, int _exp
)
363 return (float) scalbn( (double)x
, _exp
);
369 libm_hidden_def(sinf
)
396 #if defined L_scalbf && defined __UCLIBC_SUSV3_LEGACY__
397 float scalbf (float x
, float y
)
399 return (float) scalb( (double)x
, (double)y
);
407 #ifdef L_significandf
408 WRAPPER1(significand
)
420 float ynf(int n
, float x
)
422 return (float) yn(n
, (double)x
);