diff options
author | Thomas Fitzsimmons <fitzsim@redhat.com> | 2002-06-07 21:59:57 +0000 |
---|---|---|
committer | Thomas Fitzsimmons <fitzsim@redhat.com> | 2002-06-07 21:59:57 +0000 |
commit | 0953fe640f177b565578ed7ecc77169ec1a914fa (patch) | |
tree | f63c2a55e4d0e5a067da91cea95ae88a7c15af7e /newlib/libm/mathfp | |
parent | 2bd6505b3991588a15c865618e1edb76d4a6373c (diff) | |
download | cygnal-0953fe640f177b565578ed7ecc77169ec1a914fa.tar.gz cygnal-0953fe640f177b565578ed7ecc77169ec1a914fa.tar.bz2 cygnal-0953fe640f177b565578ed7ecc77169ec1a914fa.zip |
* libm/common/s_fdim.c: New file.
* libm/common/s_fma.c: Likewise.
* libm/common/s_fmax.c: Likewise.
* libm/common/s_fmin.c: Likewise.
* libm/common/s_fpclassify.c: Likewise.
* libm/common/s_lrint.c: Likewise.
* libm/common/s_lround.c: Likewise.
* libm/common/s_nearbyint.c: Likewise.
* libm/common/s_remquo.c: Likewise.
* libm/common/s_round.c: Likewise.
* libm/common/s_scalbln.c: Likewise.
* libm/common/s_signbit.c: Likewise.
* libm/common/s_trunc.c: Likewise.
* libm/common/sf_fdim.c: Likewise.
* libm/common/sf_fma.c: Likewise.
* libm/common/sf_fmax.c: Likewise.
* libm/common/sf_fmin.c: Likewise.
* libm/common/sf_lrint.c: Likewise.
* libm/common/sf_lround.c: Likewise.
* libm/common/sf_nearbyint.c: Likewise.
* libm/common/sf_remquo.c: Likewise.
* libm/common/sf_round.c: Likewise.
* libm/common/sf_scalbln.c: Likewise.
* libm/common/sf_trunc.c: Likewise.
* libm/math/w_exp2.c: Likewise.
* libm/math/w_tgamma.c: Likewise.
* libm/math/wf_exp2.c: Likewise.
* libm/math/wf_tgamma.c: Likewise.
* libm/mathfp/s_exp2.c: Likewise.
* libm/mathfp/s_tgamma.c: Likewise.
* libm/mathfp/sf_exp2.c: Likewise.
* libm/mathfp/sf_tgamma.c: Likewise.
* libm/math/er_gamma.c: Fix return value.
* libm/math/erf_gamma.c: Likewise.
* libm/mathfp/er_gamma.c: Likewise.
* libm/mathfp/erf_gamma.c: Likewise.
* libc/include/math.h (!__STRICT_ANSI__): Include ISOC99-specific
declarations and macros.
Regenerated all Makefile.in, aclocal.m4 and configure files to
use new libtool macros in top-level libtool.m4
Diffstat (limited to 'newlib/libm/mathfp')
-rw-r--r-- | newlib/libm/mathfp/Makefile.am | 6 | ||||
-rw-r--r-- | newlib/libm/mathfp/Makefile.in | 108 | ||||
-rw-r--r-- | newlib/libm/mathfp/er_gamma.c | 2 | ||||
-rw-r--r-- | newlib/libm/mathfp/erf_gamma.c | 2 | ||||
-rw-r--r-- | newlib/libm/mathfp/s_exp2.c | 18 | ||||
-rw-r--r-- | newlib/libm/mathfp/s_tgamma.c | 44 | ||||
-rw-r--r-- | newlib/libm/mathfp/sf_exp2.c | 23 | ||||
-rw-r--r-- | newlib/libm/mathfp/sf_tgamma.c | 44 |
8 files changed, 207 insertions, 40 deletions
diff --git a/newlib/libm/mathfp/Makefile.am b/newlib/libm/mathfp/Makefile.am index 11f3cf6d8..42e1989d4 100644 --- a/newlib/libm/mathfp/Makefile.am +++ b/newlib/libm/mathfp/Makefile.am @@ -20,7 +20,8 @@ src = s_acos.c s_frexp.c s_mathcnst.c \ er_gamma.c er_lgamma.c \ s_erf.c e_j0.c e_j1.c w_jn.c e_hypot.c \ w_cabs.c w_drem.c s_asinh.c s_fmod.c \ - e_scalb.c s_infconst.c s_signif.c + e_scalb.c s_infconst.c s_signif.c \ + s_exp2.c s_tgamma.c fsrc = sf_ceil.c \ sf_acos.c sf_frexp.c \ @@ -38,7 +39,8 @@ fsrc = sf_ceil.c \ erf_gamma.c erf_lgamma.c \ sf_erf.c ef_j0.c ef_j1.c wf_jn.c ef_hypot.c \ wf_cabs.c wf_drem.c sf_asinh.c sf_fmod.c \ - ef_scalb.c sf_signif.c + ef_scalb.c sf_signif.c \ + sf_exp2.c sf_tgamma.c libmathfp_la_LDFLAGS = -Xcompiler -nostdlib diff --git a/newlib/libm/mathfp/Makefile.in b/newlib/libm/mathfp/Makefile.in index 32952a44c..43546b1d7 100644 --- a/newlib/libm/mathfp/Makefile.in +++ b/newlib/libm/mathfp/Makefile.in @@ -68,8 +68,12 @@ AR = @AR@ AS = @AS@ CC = @CC@ CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ DLLTOOL = @DLLTOOL@ EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ LDFLAGS = @LDFLAGS@ LIBM_MACHINE_LIB = @LIBM_MACHINE_LIB@ LIBTOOL = @LIBTOOL@ @@ -78,8 +82,10 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ +STRIP = @STRIP@ VERSION = @VERSION@ aext = @aext@ libm_machine_dir = @libm_machine_dir@ @@ -108,7 +114,8 @@ src = s_acos.c s_frexp.c s_mathcnst.c \ er_gamma.c er_lgamma.c \ s_erf.c e_j0.c e_j1.c w_jn.c e_hypot.c \ w_cabs.c w_drem.c s_asinh.c s_fmod.c \ - e_scalb.c s_infconst.c s_signif.c + e_scalb.c s_infconst.c s_signif.c \ + s_exp2.c s_tgamma.c fsrc = sf_ceil.c \ @@ -127,7 +134,8 @@ fsrc = sf_ceil.c \ erf_gamma.c erf_lgamma.c \ sf_erf.c ef_j0.c ef_j1.c wf_jn.c ef_hypot.c \ wf_cabs.c wf_drem.c sf_asinh.c sf_fmod.c \ - ef_scalb.c sf_signif.c + ef_scalb.c sf_signif.c \ + sf_exp2.c sf_tgamma.c libmathfp_la_LDFLAGS = -Xcompiler -nostdlib @@ -186,27 +194,48 @@ DEFS = @DEFS@ -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ lib_a_LIBADD = -@USE_LIBTOOL_FALSE@lib_a_OBJECTS = s_acos.o s_frexp.o s_mathcnst.o \ -@USE_LIBTOOL_FALSE@s_cos.o s_sinh.o s_asin.o s_asine.o s_cosh.o \ -@USE_LIBTOOL_FALSE@s_ispos.o s_numtest.o s_sqrt.o s_exp.o s_ldexp.o \ -@USE_LIBTOOL_FALSE@s_pow.o s_tan.o s_atan.o s_atan2.o s_fabs.o s_log.o \ -@USE_LIBTOOL_FALSE@s_tanh.o s_log10.o s_sin.o s_floor.o s_sine.o \ -@USE_LIBTOOL_FALSE@s_atangent.o s_logarithm.o s_sineh.o s_ceil.o \ -@USE_LIBTOOL_FALSE@s_isnan.o s_isinf.o e_acosh.o e_atanh.o \ -@USE_LIBTOOL_FALSE@e_remainder.o er_gamma.o er_lgamma.o s_erf.o e_j0.o \ -@USE_LIBTOOL_FALSE@e_j1.o w_jn.o e_hypot.o w_cabs.o w_drem.o s_asinh.o \ -@USE_LIBTOOL_FALSE@s_fmod.o e_scalb.o s_infconst.o s_signif.o sf_ceil.o \ -@USE_LIBTOOL_FALSE@sf_acos.o sf_frexp.o sf_cos.o sf_sinh.o sf_asine.o \ -@USE_LIBTOOL_FALSE@sf_cosh.o sf_ispos.o sf_numtest.o sf_sqrt.o \ -@USE_LIBTOOL_FALSE@sf_asin.o sf_exp.o sf_ldexp.o sf_pow.o sf_tan.o \ -@USE_LIBTOOL_FALSE@sf_atan2.o sf_fabs.o sf_tanh.o sf_atan.o sf_log10.o \ -@USE_LIBTOOL_FALSE@sf_sin.o sf_floor.o sf_sine.o sf_atangent.o \ -@USE_LIBTOOL_FALSE@sf_logarithm.o sf_sineh.o sf_log.o sf_sineh.o \ -@USE_LIBTOOL_FALSE@sf_isnan.o sf_isinf.o ef_acosh.o ef_atanh.o \ -@USE_LIBTOOL_FALSE@ef_remainder.o erf_gamma.o erf_lgamma.o sf_erf.o \ -@USE_LIBTOOL_FALSE@ef_j0.o ef_j1.o wf_jn.o ef_hypot.o wf_cabs.o \ -@USE_LIBTOOL_FALSE@wf_drem.o sf_asinh.o sf_fmod.o ef_scalb.o \ -@USE_LIBTOOL_FALSE@sf_signif.o +@USE_LIBTOOL_FALSE@lib_a_OBJECTS = s_acos.$(OBJEXT) s_frexp.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_mathcnst.$(OBJEXT) s_cos.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_sinh.$(OBJEXT) s_asin.$(OBJEXT) s_asine.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_cosh.$(OBJEXT) s_ispos.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_numtest.$(OBJEXT) s_sqrt.$(OBJEXT) s_exp.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_ldexp.$(OBJEXT) s_pow.$(OBJEXT) s_tan.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_atan.$(OBJEXT) s_atan2.$(OBJEXT) s_fabs.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_log.$(OBJEXT) s_tanh.$(OBJEXT) s_log10.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_sin.$(OBJEXT) s_floor.$(OBJEXT) s_sine.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_atangent.$(OBJEXT) s_logarithm.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_sineh.$(OBJEXT) s_ceil.$(OBJEXT) s_isnan.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_isinf.$(OBJEXT) e_acosh.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@e_atanh.$(OBJEXT) e_remainder.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@er_gamma.$(OBJEXT) er_lgamma.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_erf.$(OBJEXT) e_j0.$(OBJEXT) e_j1.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@w_jn.$(OBJEXT) e_hypot.$(OBJEXT) w_cabs.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@w_drem.$(OBJEXT) s_asinh.$(OBJEXT) s_fmod.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@e_scalb.$(OBJEXT) s_infconst.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_signif.$(OBJEXT) s_exp2.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_tgamma.$(OBJEXT) sf_ceil.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_acos.$(OBJEXT) sf_frexp.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_cos.$(OBJEXT) sf_sinh.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_asine.$(OBJEXT) sf_cosh.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_ispos.$(OBJEXT) sf_numtest.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_sqrt.$(OBJEXT) sf_asin.$(OBJEXT) sf_exp.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_ldexp.$(OBJEXT) sf_pow.$(OBJEXT) sf_tan.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_atan2.$(OBJEXT) sf_fabs.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_tanh.$(OBJEXT) sf_atan.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_log10.$(OBJEXT) sf_sin.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_floor.$(OBJEXT) sf_sine.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_atangent.$(OBJEXT) sf_logarithm.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_sineh.$(OBJEXT) sf_log.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_sineh.$(OBJEXT) sf_isnan.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_isinf.$(OBJEXT) ef_acosh.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ef_atanh.$(OBJEXT) ef_remainder.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@erf_gamma.$(OBJEXT) erf_lgamma.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_erf.$(OBJEXT) ef_j0.$(OBJEXT) ef_j1.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@wf_jn.$(OBJEXT) ef_hypot.$(OBJEXT) wf_cabs.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@wf_drem.$(OBJEXT) sf_asinh.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_fmod.$(OBJEXT) ef_scalb.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_signif.$(OBJEXT) sf_exp2.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_tgamma.$(OBJEXT) LTLIBRARIES = $(noinst_LTLIBRARIES) libmathfp_la_LIBADD = @@ -220,18 +249,19 @@ libmathfp_la_LIBADD = @USE_LIBTOOL_TRUE@e_atanh.lo e_remainder.lo er_gamma.lo er_lgamma.lo \ @USE_LIBTOOL_TRUE@s_erf.lo e_j0.lo e_j1.lo w_jn.lo e_hypot.lo w_cabs.lo \ @USE_LIBTOOL_TRUE@w_drem.lo s_asinh.lo s_fmod.lo e_scalb.lo \ -@USE_LIBTOOL_TRUE@s_infconst.lo s_signif.lo sf_ceil.lo sf_acos.lo \ -@USE_LIBTOOL_TRUE@sf_frexp.lo sf_cos.lo sf_sinh.lo sf_asine.lo \ -@USE_LIBTOOL_TRUE@sf_cosh.lo sf_ispos.lo sf_numtest.lo sf_sqrt.lo \ -@USE_LIBTOOL_TRUE@sf_asin.lo sf_exp.lo sf_ldexp.lo sf_pow.lo sf_tan.lo \ -@USE_LIBTOOL_TRUE@sf_atan2.lo sf_fabs.lo sf_tanh.lo sf_atan.lo \ -@USE_LIBTOOL_TRUE@sf_log10.lo sf_sin.lo sf_floor.lo sf_sine.lo \ -@USE_LIBTOOL_TRUE@sf_atangent.lo sf_logarithm.lo sf_sineh.lo sf_log.lo \ -@USE_LIBTOOL_TRUE@sf_sineh.lo sf_isnan.lo sf_isinf.lo ef_acosh.lo \ -@USE_LIBTOOL_TRUE@ef_atanh.lo ef_remainder.lo erf_gamma.lo \ -@USE_LIBTOOL_TRUE@erf_lgamma.lo sf_erf.lo ef_j0.lo ef_j1.lo wf_jn.lo \ -@USE_LIBTOOL_TRUE@ef_hypot.lo wf_cabs.lo wf_drem.lo sf_asinh.lo \ -@USE_LIBTOOL_TRUE@sf_fmod.lo ef_scalb.lo sf_signif.lo +@USE_LIBTOOL_TRUE@s_infconst.lo s_signif.lo s_exp2.lo s_tgamma.lo \ +@USE_LIBTOOL_TRUE@sf_ceil.lo sf_acos.lo sf_frexp.lo sf_cos.lo \ +@USE_LIBTOOL_TRUE@sf_sinh.lo sf_asine.lo sf_cosh.lo sf_ispos.lo \ +@USE_LIBTOOL_TRUE@sf_numtest.lo sf_sqrt.lo sf_asin.lo sf_exp.lo \ +@USE_LIBTOOL_TRUE@sf_ldexp.lo sf_pow.lo sf_tan.lo sf_atan2.lo \ +@USE_LIBTOOL_TRUE@sf_fabs.lo sf_tanh.lo sf_atan.lo sf_log10.lo \ +@USE_LIBTOOL_TRUE@sf_sin.lo sf_floor.lo sf_sine.lo sf_atangent.lo \ +@USE_LIBTOOL_TRUE@sf_logarithm.lo sf_sineh.lo sf_log.lo sf_sineh.lo \ +@USE_LIBTOOL_TRUE@sf_isnan.lo sf_isinf.lo ef_acosh.lo ef_atanh.lo \ +@USE_LIBTOOL_TRUE@ef_remainder.lo erf_gamma.lo erf_lgamma.lo sf_erf.lo \ +@USE_LIBTOOL_TRUE@ef_j0.lo ef_j1.lo wf_jn.lo ef_hypot.lo wf_cabs.lo \ +@USE_LIBTOOL_TRUE@wf_drem.lo sf_asinh.lo sf_fmod.lo ef_scalb.lo \ +@USE_LIBTOOL_TRUE@sf_signif.lo sf_exp2.lo sf_tgamma.lo CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -251,7 +281,7 @@ OBJECTS = $(lib_a_OBJECTS) $(libmathfp_la_OBJECTS) all: all-redirect .SUFFIXES: -.SUFFIXES: .S .c .def .lo .o .s +.SUFFIXES: .S .c .def .lo .o .obj .s $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../Makefile.shared cd $(top_srcdir) && $(AUTOMAKE) --cygnus mathfp/Makefile @@ -272,6 +302,11 @@ maintainer-clean-noinstLIBRARIES: .c.o: $(COMPILE) -c $< +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + .s.o: $(COMPILE) -c $< @@ -280,6 +315,7 @@ maintainer-clean-noinstLIBRARIES: mostlyclean-compile: -rm -f *.o core *.core + -rm -f *.$(OBJEXT) clean-compile: diff --git a/newlib/libm/mathfp/er_gamma.c b/newlib/libm/mathfp/er_gamma.c index 6246c880b..63758bb43 100644 --- a/newlib/libm/mathfp/er_gamma.c +++ b/newlib/libm/mathfp/er_gamma.c @@ -28,5 +28,5 @@ double x; int *signgamp; #endif { - return lgamma_r(x,signgamp); + return exp (lgamma_r(x,signgamp)); } diff --git a/newlib/libm/mathfp/erf_gamma.c b/newlib/libm/mathfp/erf_gamma.c index 96e8c46ab..16be0d040 100644 --- a/newlib/libm/mathfp/erf_gamma.c +++ b/newlib/libm/mathfp/erf_gamma.c @@ -30,5 +30,5 @@ float x; int *signgamp; #endif { - return lgammaf_r(x,signgamp); + return expf (lgammaf_r(x,signgamp)); } diff --git a/newlib/libm/mathfp/s_exp2.c b/newlib/libm/mathfp/s_exp2.c new file mode 100644 index 000000000..3bcf7ca2c --- /dev/null +++ b/newlib/libm/mathfp/s_exp2.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. + * + * Permission to use, copy, modify, and distribute this software + * is freely granted, provided that this notice is preserved. + */ + +#include "fdlibm.h" + +#ifndef _DOUBLE_IS_32BITS + +double +_DEFUN (exp2, (double), + double x) +{ + return pow(2.0, x); +} + +#endif /* _DOUBLE_IS_32BITS */ diff --git a/newlib/libm/mathfp/s_tgamma.c b/newlib/libm/mathfp/s_tgamma.c new file mode 100644 index 000000000..2dec8d7e4 --- /dev/null +++ b/newlib/libm/mathfp/s_tgamma.c @@ -0,0 +1,44 @@ +/* @(#)w_gamma.c 5.1 93/09/24 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* double gamma(double x) + * Return the logarithm of the Gamma function of x or the Gamma function of x, + * depending on the library mode. + */ + +#include <math.h> + +#ifdef __STDC__ + double tgamma(double x) +#else + double tgamma(x) + double x; +#endif +{ + double y; + int local_signgam; + y = __ieee754_gamma_r(x,&local_signgam); + if (local_signgam < 0) y = -y; +#ifdef _IEEE_LIBM + return y; +#else + if(_LIB_VERSION == _IEEE_) return y; + + if(!finite(y)&&finite(x)) { + if(floor(x)==x&&x<=0.0) + return __kernel_standard(x,x,41); /* tgamma pole */ + else + return __kernel_standard(x,x,40); /* tgamma overflow */ + } + return y; +#endif +} diff --git a/newlib/libm/mathfp/sf_exp2.c b/newlib/libm/mathfp/sf_exp2.c new file mode 100644 index 000000000..7e147c5ed --- /dev/null +++ b/newlib/libm/mathfp/sf_exp2.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. + * + * Permission to use, copy, modify, and distribute this software + * is freely granted, provided that this notice is preserved. + */ + +#include "fdlibm.h" + +float +_DEFUN (exp2f, (float), + float x) +{ + return powf(2.0, x); +} + +#ifdef _DOUBLE_IS_32BITS + +double exp2 (double x) +{ + return (double) exp2f ((float) x); +} + +#endif /* _DOUBLE_IS_32BITS */ diff --git a/newlib/libm/mathfp/sf_tgamma.c b/newlib/libm/mathfp/sf_tgamma.c new file mode 100644 index 000000000..11b7a37aa --- /dev/null +++ b/newlib/libm/mathfp/sf_tgamma.c @@ -0,0 +1,44 @@ +/* w_gammaf.c -- float version of w_gamma.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#include <math.h> + +#ifdef __STDC__ + float tgammaf(float x) +#else + float tgammaf(x) + float x; +#endif +{ + float y; + int local_signgam; + y = __ieee754_gammaf_r(x,&local_signgam); + if (local_signgam < 0) y = -y; +#ifdef _IEEE_LIBM + return y; +#else + if(_LIB_VERSION == _IEEE_) return y; + + if(!finitef(y)&&finitef(x)) { + if(floorf(x)==x&&x<=(float)0.0) + /* tgammaf pole */ + return (float)__kernel_standard((double)x,(double)x,141); + else + /* tgammaf overflow */ + return (float)__kernel_standard((double)x,(double)x,140); + } + return y; +#endif +} |