| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424 | /* vi: set sw=4 ts=4: *//* * Wrapper functions implementing all the float math functions * defined by SuSv3 by actually calling the double version of * each function and then casting the result back to a float * to return to the user. * * Copyright (C) 2005 by Erik Andersen <andersen@uclibc.org> * * GNU Lesser General Public License version 2.1 or later. */#include <features.h>/* Prevent math.h from defining colliding inlines */#undef __USE_EXTERN_INLINES#include <math.h>#include <complex.h>#define WRAPPER1(func) \float func##f (float x) \{ \	return (float) func((double)x); \}#define int_WRAPPER1(func) \int func##f (float x) \{ \	return func((double)x); \}#define long_WRAPPER1(func) \long func##f (float x) \{ \	return func((double)x); \}#define long_long_WRAPPER1(func) \long long func##f (float x) \{ \	return func((double)x); \}#ifndef __DO_XSI_MATH__# undef L_j0f	/* float j0f(float x); */# undef L_j1f	/* float j1f(float x); */# undef L_jnf	/* float jnf(int n, float x); */# undef L_y0f	/* float y0f(float x); */# undef L_y1f	/* float y1f(float x); */# undef L_ynf	/* float ynf(int n, float x); */#endif/* Implement the following, as defined by SuSv3 */#if 0float       acosf(float);float       acoshf(float);float       asinf(float);float       asinhf(float);float       atan2f(float, float);float       atanf(float);float       atanhf(float);float       cargf(float complex);float       cbrtf(float);float       ceilf(float);float       copysignf(float, float);float       cosf(float);float       coshf(float);float       erfcf(float);float       erff(float);float       exp2f(float);float       expf(float);float       expm1f(float);float       fabsf(float);float       floorf(float);float       fmodf(float, float);float       frexpf(float value, int *);float       hypotf(float, float);int         ilogbf(float);float       ldexpf(float, int);float       lgammaf(float);long long   llroundf(float);float       log10f(float);float       log1pf(float);float       log2f(float);float       logbf(float);float       logf(float);long        lroundf(float);float       modff(float, float *);float       powf(float, float);float       remainderf(float, float);float       rintf(float);float       roundf(float);float       scalbnf(float, int);float       sinf(float);float       sinhf(float);float       sqrtf(float);float       tanf(float);float       tanhf(float);#endif#ifdef L_acosfWRAPPER1(acos)#endif#ifdef L_acoshfWRAPPER1(acosh)#endif#ifdef L_asinfWRAPPER1(asin)#endif#ifdef L_asinhfWRAPPER1(asinh)#endif#ifdef L_atan2ffloat atan2f (float x, float y){	return (float) atan2( (double)x, (double)y );}#endif#ifdef L_atanfWRAPPER1(atan)#endif#ifdef L_atanhfWRAPPER1(atanh)#endif#ifdef L_cargffloat cargf (float complex x){	return (float) carg( (double complex)x );}#endif#ifdef L_cbrtfWRAPPER1(cbrt)#endif#ifdef L_ceilfWRAPPER1(ceil)#endif#ifdef L_copysignffloat copysignf (float x, float y){	return (float) copysign( (double)x, (double)y );}#endif#ifdef L_cosfWRAPPER1(cos)libm_hidden_def(cosf)#endif#ifdef L_coshfWRAPPER1(cosh)#endif#ifdef L_erfcfWRAPPER1(erfc)#endif#ifdef L_erffWRAPPER1(erf)#endif#ifdef L_exp2fWRAPPER1(exp2)#endif#ifdef L_expfWRAPPER1(exp)#endif#ifdef L_expm1fWRAPPER1(expm1)#endif#ifdef L_fabsfWRAPPER1(fabs)#endif#ifdef L_fdimffloat fdimf (float x, float y){	return (float) fdim( (double)x, (double)y );}#endif#ifdef L_floorfWRAPPER1(floor)#endif#ifdef L_fmaffloat fmaf (float x, float y, float z){	return (float) fma( (double)x, (double)y, (double)z );}#endif#ifdef L_fmaxffloat fmaxf (float x, float y){	return (float) fmax( (double)x, (double)y );}#endif#ifdef L_fminffloat fminf (float x, float y){	return (float) fmin( (double)x, (double)y );}#endif#ifdef L_fmodffloat fmodf (float x, float y){	return (float) fmod( (double)x, (double)y );}#endif#ifdef L_frexpffloat frexpf (float x, int *_exp){	return (float) frexp( (double)x, _exp );}#endif#ifdef L_hypotffloat hypotf (float x, float y){	return (float) hypot( (double)x, (double)y );}#endif#ifdef L_ilogbfint_WRAPPER1(ilogb)#endif#ifdef L_j0fWRAPPER1(j0)#endif#ifdef L_j1fWRAPPER1(j1)#endif#ifdef L_jnffloat jnf(int n, float x){	return (float) jn(n, (double)x);}#endif#ifdef L_ldexpffloat ldexpf (float x, int _exp){	return (float) ldexp( (double)x, _exp );}#endif#ifdef L_lgammafWRAPPER1(lgamma)#endif#ifdef L_llrintflong_long_WRAPPER1(llrint)#endif#ifdef L_llroundflong_long_WRAPPER1(llround)#endif#ifdef L_log10fWRAPPER1(log10)#endif#ifdef L_log1pfWRAPPER1(log1p)#endif#ifdef L_log2fWRAPPER1(log2)#endif#ifdef L_logbfWRAPPER1(logb)#endif#ifdef L_logfWRAPPER1(log)#endif#ifdef L_lrintflong_WRAPPER1(lrint)#endif#ifdef L_lroundflong_WRAPPER1(lround)#endif#ifdef L_modfffloat modff (float x, float *iptr){	double y, result;	result = modf( x, &y );	*iptr = (float)y;	return (float) result;}#endif#ifdef L_nearbyintfWRAPPER1(nearbyint)#endif#ifdef L_nexttowardffloat nexttowardf (float x, long double y){	return (float) nexttoward( (double)x, (long double)y );}#endif#ifdef L_powffloat powf (float x, float y){	return (float) pow( (double)x, (double)y );}#endif#ifdef L_remainderffloat remainderf (float x, float y){	return (float) remainder( (double)x, (double)y );}#endif#ifdef L_remquoffloat remquof (float x, float y, int *quo){	return (float) remquo( (double)x, (double)y, quo );}#endif#ifdef L_rintfWRAPPER1(rint)#endif#ifdef L_roundfWRAPPER1(round)#endif#ifdef L_scalblnffloat scalblnf (float x, long _exp){	return (float) scalbln( (double)x, _exp );}#endif#ifdef L_scalbnffloat scalbnf (float x, int _exp){	return (float) scalbn( (double)x, _exp );}#endif#ifdef L_sinfWRAPPER1(sin)libm_hidden_def(sinf)#endif#ifdef L_sinhfWRAPPER1(sinh)#endif#ifdef L_sqrtfWRAPPER1(sqrt)#endif#ifdef L_tanfWRAPPER1(tan)#endif#ifdef L_tanhfWRAPPER1(tanh)#endif#ifdef L_tgammafWRAPPER1(tgamma)#endif#ifdef L_truncfWRAPPER1(trunc)#endif#if defined L_scalbf && defined __UCLIBC_SUSV3_LEGACY__float scalbf (float x, float y){	return (float) scalb( (double)x, (double)y );}#endif#ifdef L_gammafWRAPPER1(gamma)#endif#ifdef L_significandfWRAPPER1(significand)#endif#ifdef L_y0fWRAPPER1(y0)#endif#ifdef L_y1fWRAPPER1(y1)#endif#ifdef L_ynffloat ynf(int n, float x){	return (float) yn(n, (double)x);}#endif
 |