diff options
Diffstat (limited to 'newlib/libm/math')
-rw-r--r-- | newlib/libm/math/Makefile.am | 12 | ||||
-rw-r--r-- | newlib/libm/math/Makefile.in | 70 | ||||
-rw-r--r-- | newlib/libm/math/ef_atan2.c | 4 | ||||
-rw-r--r-- | newlib/libm/math/ef_hypot.c | 2 | ||||
-rw-r--r-- | newlib/libm/math/math.tex | 37 | ||||
-rw-r--r-- | newlib/libm/math/s_infconst.c | 15 | ||||
-rw-r--r-- | newlib/libm/math/s_isinf.c | 26 | ||||
-rw-r--r-- | newlib/libm/math/s_isnan.c | 122 | ||||
-rw-r--r-- | newlib/libm/math/s_ldexp.c | 2 | ||||
-rw-r--r-- | newlib/libm/math/sf_isinf.c | 33 | ||||
-rw-r--r-- | newlib/libm/math/sf_isnan.c | 47 | ||||
-rw-r--r-- | newlib/libm/math/w_j0.c | 2 | ||||
-rw-r--r-- | newlib/libm/math/w_log.c | 2 |
13 files changed, 299 insertions, 75 deletions
diff --git a/newlib/libm/math/Makefile.am b/newlib/libm/math/Makefile.am index f5971fac9..6f7195a38 100644 --- a/newlib/libm/math/Makefile.am +++ b/newlib/libm/math/Makefile.am @@ -22,9 +22,10 @@ src = k_standard.c k_rem_pio2.c \ w_cabs.c w_drem.c \ s_asinh.c s_atan.c s_ceil.c \ s_cos.c s_erf.c s_fabs.c s_floor.c \ - s_frexp.c s_ldexp.c \ + s_frexp.c s_isnan.c s_ldexp.c \ s_signif.c s_sin.c \ s_tan.c s_tanh.c \ + s_isinf.c s_infconst.c \ w_exp2.c w_tgamma.c fsrc = kf_rem_pio2.c \ @@ -45,9 +46,10 @@ fsrc = kf_rem_pio2.c \ wf_cabs.c wf_drem.c \ sf_asinh.c sf_atan.c sf_ceil.c \ sf_cos.c sf_erf.c sf_fabs.c sf_floor.c \ - sf_frexp.c sf_ldexp.c \ + sf_frexp.c sf_isnan.c sf_ldexp.c \ sf_signif.c sf_sin.c \ sf_tan.c sf_tanh.c \ + sf_isinf.c \ wf_exp2.c wf_tgamma.c libmath_la_LDFLAGS = -Xcompiler -nostdlib @@ -71,7 +73,8 @@ chobj = wacos.def wacosh.def wasin.def sasinh.def \ wgamma.def whypot.def sldexp.def wlog.def \ wlog10.def \ wpow.def wremainder.def ssin.def wsinh.def \ - wsqrt.def stan.def stanh.def + wsqrt.def stan.def stanh.def \ + sisnan.def SUFFIXES = .def @@ -175,6 +178,9 @@ stan.def: s_tan.c stanh.def: s_tanh.c $(CHEW) < $(srcdir)/s_tanh.c >$@ 2>/dev/null touch stmp-def +sisnan.def: s_isnan.c + $(CHEW) < $(srcdir)/s_isnan.c >$@ 2>/dev/null + touch stmp-def # A partial dependency list. diff --git a/newlib/libm/math/Makefile.in b/newlib/libm/math/Makefile.in index f00e189c7..49a8daf5e 100644 --- a/newlib/libm/math/Makefile.in +++ b/newlib/libm/math/Makefile.in @@ -98,10 +98,10 @@ AUTOMAKE_OPTIONS = cygnus INCLUDES = -I$(srcdir)/../common $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) -src = k_standard.c k_rem_pio2.c k_cos.c k_sin.c k_tan.c e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c e_exp.c e_fmod.c er_gamma.c e_hypot.c e_j0.c e_j1.c e_jn.c er_lgamma.c e_log.c e_log10.c e_pow.c e_rem_pio2.c e_remainder.c e_scalb.c e_sinh.c e_sqrt.c w_acos.c w_acosh.c w_asin.c w_atan2.c w_atanh.c w_cosh.c w_exp.c w_fmod.c w_gamma.c wr_gamma.c w_hypot.c w_j0.c w_j1.c w_jn.c w_lgamma.c wr_lgamma.c w_log.c w_log10.c w_pow.c w_remainder.c w_scalb.c w_sinh.c w_sqrt.c w_sincos.c w_cabs.c w_drem.c s_asinh.c s_atan.c s_ceil.c s_cos.c s_erf.c s_fabs.c s_floor.c s_frexp.c s_ldexp.c s_signif.c s_sin.c s_tan.c s_tanh.c w_exp2.c w_tgamma.c +src = k_standard.c k_rem_pio2.c k_cos.c k_sin.c k_tan.c e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c e_exp.c e_fmod.c er_gamma.c e_hypot.c e_j0.c e_j1.c e_jn.c er_lgamma.c e_log.c e_log10.c e_pow.c e_rem_pio2.c e_remainder.c e_scalb.c e_sinh.c e_sqrt.c w_acos.c w_acosh.c w_asin.c w_atan2.c w_atanh.c w_cosh.c w_exp.c w_fmod.c w_gamma.c wr_gamma.c w_hypot.c w_j0.c w_j1.c w_jn.c w_lgamma.c wr_lgamma.c w_log.c w_log10.c w_pow.c w_remainder.c w_scalb.c w_sinh.c w_sqrt.c w_sincos.c w_cabs.c w_drem.c s_asinh.c s_atan.c s_ceil.c s_cos.c s_erf.c s_fabs.c s_floor.c s_frexp.c s_isnan.c s_ldexp.c s_signif.c s_sin.c s_tan.c s_tanh.c s_isinf.c s_infconst.c w_exp2.c w_tgamma.c -fsrc = kf_rem_pio2.c kf_cos.c kf_sin.c kf_tan.c ef_acos.c ef_acosh.c ef_asin.c ef_atan2.c ef_atanh.c ef_cosh.c ef_exp.c ef_fmod.c erf_gamma.c ef_hypot.c ef_j0.c ef_j1.c ef_jn.c erf_lgamma.c ef_log.c ef_log10.c ef_pow.c ef_rem_pio2.c ef_remainder.c ef_scalb.c ef_sinh.c ef_sqrt.c wf_acos.c wf_acosh.c wf_asin.c wf_atan2.c wf_atanh.c wf_cosh.c wf_exp.c wf_fmod.c wf_gamma.c wrf_gamma.c wf_hypot.c wf_j0.c wf_j1.c wf_jn.c wf_lgamma.c wrf_lgamma.c wf_log.c wf_log10.c wf_pow.c wf_remainder.c wf_scalb.c wf_sinh.c wf_sqrt.c wf_sincos.c wf_cabs.c wf_drem.c sf_asinh.c sf_atan.c sf_ceil.c sf_cos.c sf_erf.c sf_fabs.c sf_floor.c sf_frexp.c sf_ldexp.c sf_signif.c sf_sin.c sf_tan.c sf_tanh.c wf_exp2.c wf_tgamma.c +fsrc = kf_rem_pio2.c kf_cos.c kf_sin.c kf_tan.c ef_acos.c ef_acosh.c ef_asin.c ef_atan2.c ef_atanh.c ef_cosh.c ef_exp.c ef_fmod.c erf_gamma.c ef_hypot.c ef_j0.c ef_j1.c ef_jn.c erf_lgamma.c ef_log.c ef_log10.c ef_pow.c ef_rem_pio2.c ef_remainder.c ef_scalb.c ef_sinh.c ef_sqrt.c wf_acos.c wf_acosh.c wf_asin.c wf_atan2.c wf_atanh.c wf_cosh.c wf_exp.c wf_fmod.c wf_gamma.c wrf_gamma.c wf_hypot.c wf_j0.c wf_j1.c wf_jn.c wf_lgamma.c wrf_lgamma.c wf_log.c wf_log10.c wf_pow.c wf_remainder.c wf_scalb.c wf_sinh.c wf_sqrt.c wf_sincos.c wf_cabs.c wf_drem.c sf_asinh.c sf_atan.c sf_ceil.c sf_cos.c sf_erf.c sf_fabs.c sf_floor.c sf_frexp.c sf_isnan.c sf_ldexp.c sf_signif.c sf_sin.c sf_tan.c sf_tanh.c sf_isinf.c wf_exp2.c wf_tgamma.c libmath_la_LDFLAGS = -Xcompiler -nostdlib @@ -113,7 +113,7 @@ libmath_la_LDFLAGS = -Xcompiler -nostdlib @USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a @USE_LIBTOOL_FALSE@lib_a_SOURCES = $(src) $(fsrc) -chobj = wacos.def wacosh.def wasin.def sasinh.def satan.def watan2.def watanh.def wj0.def wcosh.def serf.def wexp.def sfabs.def sfloor.def wfmod.def sfrexp.def wgamma.def whypot.def sldexp.def wlog.def wlog10.def wpow.def wremainder.def ssin.def wsinh.def wsqrt.def stan.def stanh.def +chobj = wacos.def wacosh.def wasin.def sasinh.def satan.def watan2.def watanh.def wj0.def wcosh.def serf.def wexp.def sfabs.def sfloor.def wfmod.def sfrexp.def wgamma.def whypot.def sldexp.def wlog.def wlog10.def wpow.def wremainder.def ssin.def wsinh.def wsqrt.def stan.def stanh.def sisnan.def SUFFIXES = .def @@ -154,14 +154,16 @@ lib_a_LIBADD = @USE_LIBTOOL_FALSE@w_cabs.$(OBJEXT) w_drem.$(OBJEXT) s_asinh.$(OBJEXT) \ @USE_LIBTOOL_FALSE@s_atan.$(OBJEXT) s_ceil.$(OBJEXT) s_cos.$(OBJEXT) \ @USE_LIBTOOL_FALSE@s_erf.$(OBJEXT) s_fabs.$(OBJEXT) s_floor.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_frexp.$(OBJEXT) s_ldexp.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_signif.$(OBJEXT) s_sin.$(OBJEXT) s_tan.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@s_tanh.$(OBJEXT) w_exp2.$(OBJEXT) w_tgamma.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@kf_rem_pio2.$(OBJEXT) kf_cos.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@kf_sin.$(OBJEXT) kf_tan.$(OBJEXT) ef_acos.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@ef_acosh.$(OBJEXT) ef_asin.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@ef_atan2.$(OBJEXT) ef_atanh.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@ef_cosh.$(OBJEXT) ef_exp.$(OBJEXT) ef_fmod.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_frexp.$(OBJEXT) s_isnan.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_ldexp.$(OBJEXT) s_signif.$(OBJEXT) s_sin.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_tan.$(OBJEXT) s_tanh.$(OBJEXT) s_isinf.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_infconst.$(OBJEXT) w_exp2.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@w_tgamma.$(OBJEXT) kf_rem_pio2.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@kf_cos.$(OBJEXT) kf_sin.$(OBJEXT) kf_tan.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ef_acos.$(OBJEXT) ef_acosh.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ef_asin.$(OBJEXT) ef_atan2.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ef_atanh.$(OBJEXT) ef_cosh.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ef_exp.$(OBJEXT) ef_fmod.$(OBJEXT) \ @USE_LIBTOOL_FALSE@erf_gamma.$(OBJEXT) ef_hypot.$(OBJEXT) \ @USE_LIBTOOL_FALSE@ef_j0.$(OBJEXT) ef_j1.$(OBJEXT) ef_jn.$(OBJEXT) \ @USE_LIBTOOL_FALSE@erf_lgamma.$(OBJEXT) ef_log.$(OBJEXT) \ @@ -184,9 +186,11 @@ lib_a_LIBADD = @USE_LIBTOOL_FALSE@sf_atan.$(OBJEXT) sf_ceil.$(OBJEXT) sf_cos.$(OBJEXT) \ @USE_LIBTOOL_FALSE@sf_erf.$(OBJEXT) sf_fabs.$(OBJEXT) \ @USE_LIBTOOL_FALSE@sf_floor.$(OBJEXT) sf_frexp.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@sf_ldexp.$(OBJEXT) sf_signif.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@sf_sin.$(OBJEXT) sf_tan.$(OBJEXT) sf_tanh.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@wf_exp2.$(OBJEXT) wf_tgamma.$(OBJEXT) +@USE_LIBTOOL_FALSE@sf_isnan.$(OBJEXT) sf_ldexp.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_signif.$(OBJEXT) sf_sin.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_tan.$(OBJEXT) sf_tanh.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_isinf.$(OBJEXT) wf_exp2.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@wf_tgamma.$(OBJEXT) LTLIBRARIES = $(noinst_LTLIBRARIES) libmath_la_LIBADD = @@ -203,24 +207,25 @@ libmath_la_LIBADD = @USE_LIBTOOL_TRUE@w_remainder.lo w_scalb.lo w_sinh.lo w_sqrt.lo \ @USE_LIBTOOL_TRUE@w_sincos.lo w_cabs.lo w_drem.lo s_asinh.lo s_atan.lo \ @USE_LIBTOOL_TRUE@s_ceil.lo s_cos.lo s_erf.lo s_fabs.lo s_floor.lo \ -@USE_LIBTOOL_TRUE@s_frexp.lo s_ldexp.lo s_signif.lo s_sin.lo s_tan.lo \ -@USE_LIBTOOL_TRUE@s_tanh.lo w_exp2.lo w_tgamma.lo kf_rem_pio2.lo \ -@USE_LIBTOOL_TRUE@kf_cos.lo kf_sin.lo kf_tan.lo ef_acos.lo ef_acosh.lo \ -@USE_LIBTOOL_TRUE@ef_asin.lo ef_atan2.lo ef_atanh.lo ef_cosh.lo \ -@USE_LIBTOOL_TRUE@ef_exp.lo ef_fmod.lo erf_gamma.lo ef_hypot.lo \ -@USE_LIBTOOL_TRUE@ef_j0.lo ef_j1.lo ef_jn.lo erf_lgamma.lo ef_log.lo \ -@USE_LIBTOOL_TRUE@ef_log10.lo ef_pow.lo ef_rem_pio2.lo ef_remainder.lo \ -@USE_LIBTOOL_TRUE@ef_scalb.lo ef_sinh.lo ef_sqrt.lo wf_acos.lo \ -@USE_LIBTOOL_TRUE@wf_acosh.lo wf_asin.lo wf_atan2.lo wf_atanh.lo \ -@USE_LIBTOOL_TRUE@wf_cosh.lo wf_exp.lo wf_fmod.lo wf_gamma.lo \ -@USE_LIBTOOL_TRUE@wrf_gamma.lo wf_hypot.lo wf_j0.lo wf_j1.lo wf_jn.lo \ -@USE_LIBTOOL_TRUE@wf_lgamma.lo wrf_lgamma.lo wf_log.lo wf_log10.lo \ -@USE_LIBTOOL_TRUE@wf_pow.lo wf_remainder.lo wf_scalb.lo wf_sinh.lo \ -@USE_LIBTOOL_TRUE@wf_sqrt.lo wf_sincos.lo wf_cabs.lo wf_drem.lo \ -@USE_LIBTOOL_TRUE@sf_asinh.lo sf_atan.lo sf_ceil.lo sf_cos.lo sf_erf.lo \ -@USE_LIBTOOL_TRUE@sf_fabs.lo sf_floor.lo sf_frexp.lo sf_ldexp.lo \ +@USE_LIBTOOL_TRUE@s_frexp.lo s_isnan.lo s_ldexp.lo s_signif.lo s_sin.lo \ +@USE_LIBTOOL_TRUE@s_tan.lo s_tanh.lo s_isinf.lo s_infconst.lo w_exp2.lo \ +@USE_LIBTOOL_TRUE@w_tgamma.lo kf_rem_pio2.lo kf_cos.lo kf_sin.lo \ +@USE_LIBTOOL_TRUE@kf_tan.lo ef_acos.lo ef_acosh.lo ef_asin.lo \ +@USE_LIBTOOL_TRUE@ef_atan2.lo ef_atanh.lo ef_cosh.lo ef_exp.lo \ +@USE_LIBTOOL_TRUE@ef_fmod.lo erf_gamma.lo ef_hypot.lo ef_j0.lo ef_j1.lo \ +@USE_LIBTOOL_TRUE@ef_jn.lo erf_lgamma.lo ef_log.lo ef_log10.lo \ +@USE_LIBTOOL_TRUE@ef_pow.lo ef_rem_pio2.lo ef_remainder.lo ef_scalb.lo \ +@USE_LIBTOOL_TRUE@ef_sinh.lo ef_sqrt.lo wf_acos.lo wf_acosh.lo \ +@USE_LIBTOOL_TRUE@wf_asin.lo wf_atan2.lo wf_atanh.lo wf_cosh.lo \ +@USE_LIBTOOL_TRUE@wf_exp.lo wf_fmod.lo wf_gamma.lo wrf_gamma.lo \ +@USE_LIBTOOL_TRUE@wf_hypot.lo wf_j0.lo wf_j1.lo wf_jn.lo wf_lgamma.lo \ +@USE_LIBTOOL_TRUE@wrf_lgamma.lo wf_log.lo wf_log10.lo wf_pow.lo \ +@USE_LIBTOOL_TRUE@wf_remainder.lo wf_scalb.lo wf_sinh.lo wf_sqrt.lo \ +@USE_LIBTOOL_TRUE@wf_sincos.lo wf_cabs.lo wf_drem.lo sf_asinh.lo \ +@USE_LIBTOOL_TRUE@sf_atan.lo sf_ceil.lo sf_cos.lo sf_erf.lo sf_fabs.lo \ +@USE_LIBTOOL_TRUE@sf_floor.lo sf_frexp.lo sf_isnan.lo sf_ldexp.lo \ @USE_LIBTOOL_TRUE@sf_signif.lo sf_sin.lo sf_tan.lo sf_tanh.lo \ -@USE_LIBTOOL_TRUE@wf_exp2.lo wf_tgamma.lo +@USE_LIBTOOL_TRUE@sf_isinf.lo wf_exp2.lo wf_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) @@ -546,6 +551,9 @@ stan.def: s_tan.c stanh.def: s_tanh.c $(CHEW) < $(srcdir)/s_tanh.c >$@ 2>/dev/null touch stmp-def +sisnan.def: s_isnan.c + $(CHEW) < $(srcdir)/s_isnan.c >$@ 2>/dev/null + touch stmp-def # A partial dependency list. diff --git a/newlib/libm/math/ef_atan2.c b/newlib/libm/math/ef_atan2.c index d57480b03..45b5acb0c 100644 --- a/newlib/libm/math/ef_atan2.c +++ b/newlib/libm/math/ef_atan2.c @@ -25,8 +25,8 @@ tiny = 1.0e-30, zero = 0.0, pi_o_4 = 7.8539818525e-01, /* 0x3f490fdb */ pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */ -pi = 3.1415927410e+00, /* 0x40490fdb */ -pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */ +pi = 3.1415925026e+00, /* 0x40490fda */ +pi_lo = 1.5099578832e-07; /* 0x34222168 */ #ifdef __STDC__ float __ieee754_atan2f(float y, float x) diff --git a/newlib/libm/math/ef_hypot.c b/newlib/libm/math/ef_hypot.c index 9368eb41c..b78b968ef 100644 --- a/newlib/libm/math/ef_hypot.c +++ b/newlib/libm/math/ef_hypot.c @@ -50,7 +50,7 @@ if(FLT_UWORD_IS_ZERO(hb)) { return a; } else if(FLT_UWORD_IS_SUBNORMAL(hb)) { - SET_FLOAT_WORD(t1,0x7e800000L); /* t1=2^126 */ + SET_FLOAT_WORD(t1,0x3f000000L); /* t1=2^126 */ b *= t1; a *= t1; k -= 126; diff --git a/newlib/libm/math/math.tex b/newlib/libm/math/math.tex index 7bc56ce9a..0b1e596fb 100644 --- a/newlib/libm/math/math.tex +++ b/newlib/libm/math/math.tex @@ -25,7 +25,7 @@ Since the error handling code calls @code{fputs}, the mathematical subroutines require stubs or minimal implementations for the same list of OS subroutines as @code{fputs}: @code{close}, @code{fstat}, @code{isatty}, @code{lseek}, @code{read}, @code{sbrk}, @code{write}. -@xref{syscalls,,System Calls, libc.info, The Red Hat newlib C Library}, +@xref{syscalls,,System Calls, libc.info, The Cygnus C Support Library}, for a discussion and for sample minimal implementations of these support subroutines. @@ -139,12 +139,6 @@ The library is set to X/Open mode by default. @include math/wj0.def @page -@include common/scbrt.def - -@page -@include common/scopysign.def - -@page @include math/wcosh.def @page @@ -154,9 +148,6 @@ The library is set to X/Open mode by default. @include math/wexp.def @page -@include common/sexpm1.def - -@page @include math/sfabs.def @page @@ -175,13 +166,7 @@ The library is set to X/Open mode by default. @include math/whypot.def @page -@include common/silogb.def - -@page -@include common/sinfinity.def - -@page -@include common/sisnan.def +@include math/sisnan.def @page @include math/sldexp.def @@ -193,30 +178,12 @@ The library is set to X/Open mode by default. @include math/wlog10.def @page -@include common/slog1p.def - -@page -@include common/smatherr.def - -@page -@include common/smodf.def - -@page -@include common/snan.def - -@page -@include common/snextafter.def - -@page @include math/wpow.def @page @include math/wremainder.def @page -@include common/sscalbn.def - -@page @include math/wsqrt.def @page diff --git a/newlib/libm/math/s_infconst.c b/newlib/libm/math/s_infconst.c new file mode 100644 index 000000000..6b63afbca --- /dev/null +++ b/newlib/libm/math/s_infconst.c @@ -0,0 +1,15 @@ +/* Infinity as a constant value. This is used for HUGE_VAL. + * Added by Cygnus Support. + */ + +#include "fdlibm.h" + +#ifndef _DOUBLE_IS_32BITS +#ifdef __IEEE_BIG_ENDIAN +const union __dmath __infinity[1] = {{{ 0x7ff00000, 0 }}}; +#else +const union __dmath __infinity[1] = {{{ 0, 0x7ff00000 }}}; +#endif +#else /* defined (_DOUBLE_IS_32BITS) */ +const union __dmath __infinity[1] = {{{ 0x7f800000, 0 }}}; +#endif /* defined (_DOUBLE_IS_32BITS) */ diff --git a/newlib/libm/math/s_isinf.c b/newlib/libm/math/s_isinf.c new file mode 100644 index 000000000..87f099566 --- /dev/null +++ b/newlib/libm/math/s_isinf.c @@ -0,0 +1,26 @@ +/* + * isinf(x) returns 1 if x is infinity, else 0; + * no branching! + * Added by Cygnus Support. + */ + +#include "fdlibm.h" + +#ifndef _DOUBLE_IS_32BITS + +#ifdef __STDC__ + int isinf(double x) +#else + int isinf(x) + double x; +#endif +{ + __int32_t hx,lx; + EXTRACT_WORDS(hx,lx,x); + hx &= 0x7fffffff; + hx |= (__uint32_t)(lx|(-lx))>>31; + hx = 0x7ff00000 - hx; + return 1 - (int)((__uint32_t)(hx|(-hx))>>31); +} + +#endif /* _DOUBLE_IS_32BITS */ diff --git a/newlib/libm/math/s_isnan.c b/newlib/libm/math/s_isnan.c new file mode 100644 index 000000000..0338cfe47 --- /dev/null +++ b/newlib/libm/math/s_isnan.c @@ -0,0 +1,122 @@ + +/* @(#)s_isnan.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. + * ==================================================== + */ + +/* +FUNCTION + <<isnan>>,<<isnanf>>,<<isinf>>,<<isinff>>,<<finite>>,<<finitef>>---test for exceptional numbers + +INDEX + isnan +INDEX + isinf +INDEX + finite + +INDEX + isnanf +INDEX + isinff +INDEX + finitef + +ANSI_SYNOPSIS + #include <ieeefp.h> + int isnan(double <[arg]>); + int isinf(double <[arg]>); + int finite(double <[arg]>); + int isnanf(float <[arg]>); + int isinff(float <[arg]>); + int finitef(float <[arg]>); + +TRAD_SYNOPSIS + #include <ieeefp.h> + int isnan(<[arg]>) + double <[arg]>; + int isinf(<[arg]>) + double <[arg]>; + int finite(<[arg]>); + double <[arg]>; + int isnanf(<[arg]>); + float <[arg]>; + int isinff(<[arg]>); + float <[arg]>; + int finitef(<[arg]>); + float <[arg]>; + + +DESCRIPTION + These functions provide information on the floating-point + argument supplied. + + There are five major number formats - + o+ + o zero + a number which contains all zero bits. + o subnormal + Is used to represent number with a zero exponent, but a nonzero fraction. + o normal + A number with an exponent, and a fraction + o infinity + A number with an all 1's exponent and a zero fraction. + o NAN + A number with an all 1's exponent and a nonzero fraction. + + o- + + <<isnan>> returns 1 if the argument is a nan. <<isinf>> + returns 1 if the argument is infinity. <<finite>> returns 1 if the + argument is zero, subnormal or normal. + + The <<isnanf>>, <<isinff>> and <<finitef>> perform the same + operations as their <<isnan>>, <<isinf>> and <<finite>> + counterparts, but on single-precision floating-point numbers. + +QUICKREF + isnan - pure +QUICKREF + isinf - pure +QUICKREF + finite - pure +QUICKREF + isnan - pure +QUICKREF + isinf - pure +QUICKREF + finite - pure +*/ + +/* + * isnan(x) returns 1 is x is nan, else 0; + * no branching! + */ + +#include "fdlibm.h" + +#ifndef _DOUBLE_IS_32BITS + +#ifdef __STDC__ + int isnan(double x) +#else + int isnan(x) + double x; +#endif +{ + __int32_t hx,lx; + EXTRACT_WORDS(hx,lx,x); + hx &= 0x7fffffff; + hx |= (__uint32_t)(lx|(-lx))>>31; + hx = 0x7ff00000 - hx; + return (int)(((__uint32_t)(hx))>>31); +} + +#endif /* _DOUBLE_IS_32BITS */ diff --git a/newlib/libm/math/s_ldexp.c b/newlib/libm/math/s_ldexp.c index adc7d5d0e..e5d45633d 100644 --- a/newlib/libm/math/s_ldexp.c +++ b/newlib/libm/math/s_ldexp.c @@ -56,7 +56,7 @@ On underflow, <<ldexp>> and <<ldexpf>> return 0.0. On overflow, <<ldexp>> returns plus or minus <<HUGE_VAL>>. PORTABILITY -<<ldexp>> is ANSI. <<ldexpf>> is an extension. +<<ldexp>> is ANSI, <<ldexpf>> is an extension. */ diff --git a/newlib/libm/math/sf_isinf.c b/newlib/libm/math/sf_isinf.c new file mode 100644 index 000000000..43a8abdf2 --- /dev/null +++ b/newlib/libm/math/sf_isinf.c @@ -0,0 +1,33 @@ +/* + * isinff(x) returns 1 if x is +-infinity, else 0; + * Added by Cygnus Support. + */ + +#include "fdlibm.h" + +#ifdef __STDC__ + int isinff(float x) +#else + int isinff(x) + float x; +#endif +{ + __int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; + return FLT_UWORD_IS_INFINITE(ix); +} + +#ifdef _DOUBLE_IS_32BITS + +#ifdef __STDC__ + int isinf(double x) +#else + int isinf(x) + double x; +#endif +{ + return isinff((float) x); +} + +#endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/newlib/libm/math/sf_isnan.c b/newlib/libm/math/sf_isnan.c new file mode 100644 index 000000000..0b4be3e9c --- /dev/null +++ b/newlib/libm/math/sf_isnan.c @@ -0,0 +1,47 @@ +/* sf_isnan.c -- float version of s_isnan.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. + * ==================================================== + */ + +/* + * isnanf(x) returns 1 is x is nan, else 0; + */ + +#include "fdlibm.h" + +#ifdef __STDC__ + int isnanf(float x) +#else + int isnanf(x) + float x; +#endif +{ + __int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; + return FLT_UWORD_IS_NAN(ix); +} + +#ifdef _DOUBLE_IS_32BITS + +#ifdef __STDC__ + int isnan(double x) +#else + int isnan(x) + double x; +#endif +{ + return isnanf((float) x); +} + +#endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/newlib/libm/math/w_j0.c b/newlib/libm/math/w_j0.c index e4dde5ccb..2bf663316 100644 --- a/newlib/libm/math/w_j0.c +++ b/newlib/libm/math/w_j0.c @@ -13,7 +13,7 @@ /* FUNCTION -<<jN>>, <<jNf>>, <<yN>>, <<yNf>>---Bessel functions +<<jN>>,<<jNf>>,<<yN>>,<<yNf>>---Bessel functions INDEX j0 diff --git a/newlib/libm/math/w_log.c b/newlib/libm/math/w_log.c index 3e750ad85..dcc8b9762 100644 --- a/newlib/libm/math/w_log.c +++ b/newlib/libm/math/w_log.c @@ -49,7 +49,7 @@ When <[x]> is negative, the returned value is <<-HUGE_VAL>> and <<matherr>>. PORTABILITY -<<log>> is ANSI. <<logf>> is an extension. +<<log>> is ANSI, <<logf>> is an extension. */ /* |