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.
16 /* For the time being, do _NOT_ implement these functions
17 * that are defined by SuSv3 */
18 #undef L_exp2f /*float exp2f(float);*/
19 #undef L_fdimf /*float fdimf(float, float);*/
20 #undef L_fmaf /*float fmaf(float, float, float);*/
21 #undef L_fmaxf /*float fmaxf(float, float);*/
22 #undef L_fminf /*float fminf(float, float);*/
23 #undef L_log2f /*float log2f(float);*/
24 #undef L_nearbyintf /*float nearbyintf(float);*/
25 #undef L_nexttowardf /*float nexttowardf(float, long double);*/
26 #undef L_remquof /*float remquof(float, float, int *);*/
27 #undef L_scalblnf /*float scalblnf(float, long);*/
28 #undef L_tgammaf /*float tgammaf(float);*/
30 /* Implement the following, as defined by SuSv3 */
36 float atan2f(float, float);
41 float copysignf(float, float);
50 float fmodf(float, float);
51 float frexpf(float value, int *);
52 float hypotf(float, float);
54 float ldexpf(float, int);
56 long long llroundf(float);
62 float modff(float, float *);
63 float nextafterf(float, float);
64 float powf(float, float);
65 float remainderf(float, float);
68 float scalbnf(float, int);
80 return (float) acos( (double)x );
86 float acoshf (float x)
88 return (float) acosh( (double)x );
96 return (float) asin( (double)x );
102 float asinhf (float x)
104 return (float) asinh( (double)x );
110 float atan2f (float x, float y)
112 return (float) atan2( (double)x, (double)y );
118 float atanf (float x)
120 return (float) atan( (double)x );
126 float atanhf (float x)
128 return (float) atanh( (double)x );
134 float cargf (float complex x)
136 return (float) carg( (double)x );
142 float cbrtf (float x)
144 return (float) cbrt( (double)x );
150 float ceilf (float x)
152 return (float) ceil( (double)x );
158 float copysignf (float x, float y)
160 return (float) copysign( (double)x, (double)y );
168 return (float) cos( (double)x );
174 float coshf (float x)
176 return (float) cosh( (double)x );
182 float erfcf (float x)
184 return (float) erfc( (double)x );
192 return (float) erf( (double)x );
198 float exp2f (float x)
200 return (float) exp2( (double)x );
208 return (float) exp( (double)x );
214 float expm1f (float x)
216 return (float) expm1( (double)x );
222 float fabsf (float x)
224 return (float) fabs( (double)x );
230 float fdimf (float x, float y)
232 return (float) fdim( (double)x, (double)y );
238 float floorf (float x)
240 return (float) floor( (double)x );
246 float fmaf (float x, float y, float z)
248 return (float) fma( (double)x, (double)y, (double)z );
254 float fmaxf (float x, float y)
256 return (float) fmax( (double)x, (double)y );
262 float fminf (float x, float y)
264 return (float) fmin( (double)x, (double)y );
270 float fmodf (float x, float y)
272 return (float) fmod( (double)x, (double)y );
278 float frexpf (float x, int *_exp)
280 return (float) frexp( (double)x, _exp );
286 float hypotf (float x, float y)
288 return (float) hypot( (double)x, (double)y );
296 return (int) ilogb( (double)x );
302 float ldexpf (float x, int _exp)
304 return (float) ldexp( (double)x, _exp );
310 float lgammaf (float x)
312 return (float) lgamma( (double)x );
318 long long llrintf (float x)
320 return (long long) llrint( (double)x );
326 long long llroundf (float x)
328 return (long long) llround( (double)x );
334 float log10f (float x)
336 return (float) log10( (double)x );
342 float log1pf (float x)
344 return (float) log1p( (double)x );
350 float log2f (float x)
352 return (float) log2( (double)x );
358 float logbf (float x)
360 return (float) logb( (double)x );
368 return (float) log( (double)x );
374 long lrintf (float x)
376 return (long) lrint( (double)x );
382 long lroundf (float x)
384 return (long) lround( (double)x );
390 float modff (float x, float *iptr)
393 result = modf ( x, &y );
395 return (float) result;
402 float nearbyintf (float x)
404 return (float) nearbyint( (double)x );
410 float nextafterf (float x, float y)
412 return (float) nextafter( (double)x, (double)y );
418 float nexttowardf (float x, long double y)
420 return (float) nexttoward( (double)x, (double)y );
426 float powf (float x, float y)
428 return (float) pow( (double)x, (double)y );
434 float remainderf (float x, float y)
436 return (float) remainder( (double)x, (double)y );
442 float remquof (float x, float y, int *quo)
444 return (float) remquo( (double)x, (double)y, quo );
450 float rintf (float x)
452 return (float) rint( (double)x );
458 float roundf (float x)
460 return (float) round( (double)x );
466 float scalblnf (float x, long _exp)
468 return (float) scalbln( (double)x, _exp );
474 float scalbnf (float x, int _exp)
476 return (float) scalbn( (double)x, _exp );
484 return (float) sin( (double)x );
490 float sinhf (float x)
492 return (float) sinh( (double)x );
498 float sqrtf (float x)
500 return (float) sqrt( (double)x );
508 return (float) tan( (double)x );
514 float tanhf (float x)
516 return (float) tanh( (double)x );
522 float tgammaf (float x)
524 return (float) tgamma( (double)x );
530 float truncf (float x)
532 return (float) trunc( (double)x );