diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2006-02-27 23:51:28 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2006-02-27 23:51:28 +0000 |
commit | e48682cff514c0480aff58a3e752edf7eb9ff228 (patch) | |
tree | 0e9c096a2b54e60d287d32cec39017b36714871c /newlib/libm/common | |
parent | 47a5b664e5095434abe0630008fce5dc9f323130 (diff) | |
download | newlib-e48682cff514c0480aff58a3e752edf7eb9ff228.zip newlib-e48682cff514c0480aff58a3e752edf7eb9ff228.tar.gz newlib-e48682cff514c0480aff58a3e752edf7eb9ff228.tar.bz2 |
2006-02-27 Jeff Johnston <jjohnstn@redhat.com>
* Makefile.am (MATHOBJS_IN_LIBC): Add s_isinfd, sf_isinff,
s_isnand, and sf_isnanf object files.
* Makefile.in: Regenerated.
* libc/include/ieeefp.h: Undef isnan and isinf to avoid
conflict if <math.h> has previously been included.
* libc/include/math.h
* libm/common/Makefile.am: Add new s_isinfd, s_isnand, sf_isinff,
and sf_isnanf files. Also support s_isnan, sf_isnan, s_isinf, and
sf_isinf files which have been moved from math/mathfp directories.
* libm/common/Makefile.in: Regenerated.
* libm/common/s_isinfd.c: New file.
* libm/common/s_isnand.c: Ditto.
* libm/common/sf_isinff.c: Ditto.
* libm/common/sf_isnanf.c: Ditto.
* libm/common/s_isinf.c: Moved from libm/math directory.
* libm/common/s_isnan.c: Ditto.
* libm/common/sf_isinf.c: Ditto.
* libm/common/sf_isnan.c: Ditto.
* libm/math/Makefile.am: Remove isinf and isnan family functions
which have been moved into common directory.
* libm/mathfp/Makefile.am: Ditto.
* libm/math/Makefile.in: Regenerated.
* libm/mathfp/Makefile.in: Ditto.
* libm/math/s_isinf.c: Removed.
* libm/math/s_isnan.c: Ditto.
* libm/math/sf_isinf.c: Ditto.
* libm/math/sf_isnan.c: Ditto.
* libm/mathfp/s_isinf.c: Ditto.
* libm/mathfp/s_isnan.c: Ditto.
* libm/mathfp/sf_isinf.c: Ditto.
* libm/mathfp/sf_isnan.c: Ditto.
Diffstat (limited to 'newlib/libm/common')
-rw-r--r-- | newlib/libm/common/Makefile.am | 12 | ||||
-rw-r--r-- | newlib/libm/common/Makefile.in | 22 | ||||
-rw-r--r-- | newlib/libm/common/s_isinf.c | 29 | ||||
-rw-r--r-- | newlib/libm/common/s_isinfd.c | 23 | ||||
-rw-r--r-- | newlib/libm/common/s_isnan.c | 135 | ||||
-rw-r--r-- | newlib/libm/common/s_isnand.c | 122 | ||||
-rw-r--r-- | newlib/libm/common/sf_isinf.c | 29 | ||||
-rw-r--r-- | newlib/libm/common/sf_isinff.c | 27 | ||||
-rw-r--r-- | newlib/libm/common/sf_isnan.c | 42 | ||||
-rw-r--r-- | newlib/libm/common/sf_isnanf.c | 37 |
10 files changed, 469 insertions, 9 deletions
diff --git a/newlib/libm/common/Makefile.am b/newlib/libm/common/Makefile.am index ba7f310..d6d7e51 100644 --- a/newlib/libm/common/Makefile.am +++ b/newlib/libm/common/Makefile.am @@ -6,7 +6,8 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) src = s_finite.c s_copysign.c s_modf.c s_scalbn.c \ s_cbrt.c s_expm1.c s_ilogb.c s_infconst.c \ - s_infinity.c s_log1p.c s_nan.c s_nextafter.c \ + s_infinity.c s_isinf.c s_isinfd.c s_isnan.c s_isnand.c \ + s_log1p.c s_nan.c s_nextafter.c \ s_rint.c s_logb.c s_matherr.c s_lib_ver.c \ s_fdim.c s_fma.c s_fmax.c s_fmin.c s_fpclassify.c s_lrint.c \ s_lround.c s_nearbyint.c s_remquo.c s_round.c s_scalbln.c \ @@ -14,7 +15,8 @@ src = s_finite.c s_copysign.c s_modf.c s_scalbn.c \ fsrc = sf_finite.c sf_copysign.c sf_modf.c sf_scalbn.c \ sf_cbrt.c sf_expm1.c sf_ilogb.c \ - sf_infinity.c sf_log1p.c sf_nan.c sf_nextafter.c \ + sf_infinity.c sf_isinf.c sf_isinff.c sf_isnan.c sf_isnanf.c \ + sf_log1p.c sf_nan.c sf_nextafter.c \ sf_rint.c sf_logb.c \ sf_fdim.c sf_fma.c sf_fmax.c sf_fmin.c sf_lrint.c \ sf_lround.c sf_nearbyint.c sf_remquo.c sf_round.c \ @@ -35,7 +37,7 @@ endif # USE_LIBTOOL include $(srcdir)/../../Makefile.shared chobj = scbrt.def scopysign.def sexpm1.def silogb.def \ - sinfinity.def slog1p.def smatherr.def smodf.def \ + sinfinity.def sisnan.def slog1p.def smatherr.def smodf.def \ snan.def snextafter.def sscalbn.def SUFFIXES = .def @@ -91,6 +93,10 @@ sinfinity.def: s_infinity.c $(CHEW) < $(srcdir)/s_infinity.c >$@ 2>/dev/null touch stmp-def +sisnan.def: s_isnan.c + $(CHEW) < $(srcdir)/s_isnan.c >$@ 2>/dev/null + touch stmp-def + slog1p.def: s_log1p.c $(CHEW) < $(srcdir)/s_log1p.c >$@ 2>/dev/null touch stmp-def diff --git a/newlib/libm/common/Makefile.in b/newlib/libm/common/Makefile.in index e71136f..4e9db8b 100644 --- a/newlib/libm/common/Makefile.in +++ b/newlib/libm/common/Makefile.in @@ -98,10 +98,10 @@ AUTOMAKE_OPTIONS = cygnus INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) -src = s_finite.c s_copysign.c s_modf.c s_scalbn.c s_cbrt.c s_expm1.c s_ilogb.c s_infconst.c s_infinity.c s_log1p.c s_nan.c s_nextafter.c s_rint.c s_logb.c s_matherr.c s_lib_ver.c s_fdim.c s_fma.c s_fmax.c s_fmin.c s_fpclassify.c s_lrint.c s_lround.c s_nearbyint.c s_remquo.c s_round.c s_scalbln.c s_signbit.c s_trunc.c +src = s_finite.c s_copysign.c s_modf.c s_scalbn.c s_cbrt.c s_expm1.c s_ilogb.c s_infconst.c s_infinity.c s_isinf.c s_isinfd.c s_isnan.c s_isnand.c s_log1p.c s_nan.c s_nextafter.c s_rint.c s_logb.c s_matherr.c s_lib_ver.c s_fdim.c s_fma.c s_fmax.c s_fmin.c s_fpclassify.c s_lrint.c s_lround.c s_nearbyint.c s_remquo.c s_round.c s_scalbln.c s_signbit.c s_trunc.c -fsrc = sf_finite.c sf_copysign.c sf_modf.c sf_scalbn.c sf_cbrt.c sf_expm1.c sf_ilogb.c sf_infinity.c sf_log1p.c sf_nan.c sf_nextafter.c sf_rint.c sf_logb.c sf_fdim.c sf_fma.c sf_fmax.c sf_fmin.c sf_lrint.c sf_lround.c sf_nearbyint.c sf_remquo.c sf_round.c sf_scalbln.c sf_trunc.c +fsrc = sf_finite.c sf_copysign.c sf_modf.c sf_scalbn.c sf_cbrt.c sf_expm1.c sf_ilogb.c sf_infinity.c sf_isinf.c sf_isinff.c sf_isnan.c sf_isnanf.c sf_log1p.c sf_nan.c sf_nextafter.c sf_rint.c sf_logb.c sf_fdim.c sf_fma.c sf_fmax.c sf_fmin.c sf_lrint.c sf_lround.c sf_nearbyint.c sf_remquo.c sf_round.c sf_scalbln.c sf_trunc.c libcommon_la_LDFLAGS = -Xcompiler -nostdlib @@ -113,7 +113,7 @@ libcommon_la_LDFLAGS = -Xcompiler -nostdlib @USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a @USE_LIBTOOL_FALSE@lib_a_SOURCES = $(src) $(fsrc) -chobj = scbrt.def scopysign.def sexpm1.def silogb.def sinfinity.def slog1p.def smatherr.def smodf.def snan.def snextafter.def sscalbn.def +chobj = scbrt.def scopysign.def sexpm1.def silogb.def sinfinity.def sisnan.def slog1p.def smatherr.def smodf.def snan.def snextafter.def sscalbn.def SUFFIXES = .def @@ -137,6 +137,8 @@ lib_a_LIBADD = @USE_LIBTOOL_FALSE@s_scalbn.$(OBJEXT) s_cbrt.$(OBJEXT) \ @USE_LIBTOOL_FALSE@s_expm1.$(OBJEXT) s_ilogb.$(OBJEXT) \ @USE_LIBTOOL_FALSE@s_infconst.$(OBJEXT) s_infinity.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_isinf.$(OBJEXT) s_isinfd.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@s_isnan.$(OBJEXT) s_isnand.$(OBJEXT) \ @USE_LIBTOOL_FALSE@s_log1p.$(OBJEXT) s_nan.$(OBJEXT) \ @USE_LIBTOOL_FALSE@s_nextafter.$(OBJEXT) s_rint.$(OBJEXT) \ @USE_LIBTOOL_FALSE@s_logb.$(OBJEXT) s_matherr.$(OBJEXT) \ @@ -150,7 +152,9 @@ lib_a_LIBADD = @USE_LIBTOOL_FALSE@sf_copysign.$(OBJEXT) sf_modf.$(OBJEXT) \ @USE_LIBTOOL_FALSE@sf_scalbn.$(OBJEXT) sf_cbrt.$(OBJEXT) \ @USE_LIBTOOL_FALSE@sf_expm1.$(OBJEXT) sf_ilogb.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@sf_infinity.$(OBJEXT) sf_log1p.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_infinity.$(OBJEXT) sf_isinf.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_isinff.$(OBJEXT) sf_isnan.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@sf_isnanf.$(OBJEXT) sf_log1p.$(OBJEXT) \ @USE_LIBTOOL_FALSE@sf_nan.$(OBJEXT) sf_nextafter.$(OBJEXT) \ @USE_LIBTOOL_FALSE@sf_rint.$(OBJEXT) sf_logb.$(OBJEXT) \ @USE_LIBTOOL_FALSE@sf_fdim.$(OBJEXT) sf_fma.$(OBJEXT) sf_fmax.$(OBJEXT) \ @@ -163,14 +167,16 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) libcommon_la_LIBADD = @USE_LIBTOOL_TRUE@libcommon_la_OBJECTS = s_finite.lo s_copysign.lo \ @USE_LIBTOOL_TRUE@s_modf.lo s_scalbn.lo s_cbrt.lo s_expm1.lo s_ilogb.lo \ -@USE_LIBTOOL_TRUE@s_infconst.lo s_infinity.lo s_log1p.lo s_nan.lo \ +@USE_LIBTOOL_TRUE@s_infconst.lo s_infinity.lo s_isinf.lo s_isinfd.lo \ +@USE_LIBTOOL_TRUE@s_isnan.lo s_isnand.lo s_log1p.lo s_nan.lo \ @USE_LIBTOOL_TRUE@s_nextafter.lo s_rint.lo s_logb.lo s_matherr.lo \ @USE_LIBTOOL_TRUE@s_lib_ver.lo s_fdim.lo s_fma.lo s_fmax.lo s_fmin.lo \ @USE_LIBTOOL_TRUE@s_fpclassify.lo s_lrint.lo s_lround.lo s_nearbyint.lo \ @USE_LIBTOOL_TRUE@s_remquo.lo s_round.lo s_scalbln.lo s_signbit.lo \ @USE_LIBTOOL_TRUE@s_trunc.lo sf_finite.lo sf_copysign.lo sf_modf.lo \ @USE_LIBTOOL_TRUE@sf_scalbn.lo sf_cbrt.lo sf_expm1.lo sf_ilogb.lo \ -@USE_LIBTOOL_TRUE@sf_infinity.lo sf_log1p.lo sf_nan.lo sf_nextafter.lo \ +@USE_LIBTOOL_TRUE@sf_infinity.lo sf_isinf.lo sf_isinff.lo sf_isnan.lo \ +@USE_LIBTOOL_TRUE@sf_isnanf.lo sf_log1p.lo sf_nan.lo sf_nextafter.lo \ @USE_LIBTOOL_TRUE@sf_rint.lo sf_logb.lo sf_fdim.lo sf_fma.lo sf_fmax.lo \ @USE_LIBTOOL_TRUE@sf_fmin.lo sf_lrint.lo sf_lround.lo sf_nearbyint.lo \ @USE_LIBTOOL_TRUE@sf_remquo.lo sf_round.lo sf_scalbln.lo sf_trunc.lo @@ -450,6 +456,10 @@ sinfinity.def: s_infinity.c $(CHEW) < $(srcdir)/s_infinity.c >$@ 2>/dev/null touch stmp-def +sisnan.def: s_isnan.c + $(CHEW) < $(srcdir)/s_isnan.c >$@ 2>/dev/null + touch stmp-def + slog1p.def: s_log1p.c $(CHEW) < $(srcdir)/s_log1p.c >$@ 2>/dev/null touch stmp-def diff --git a/newlib/libm/common/s_isinf.c b/newlib/libm/common/s_isinf.c new file mode 100644 index 0000000..db8e8f8 --- /dev/null +++ b/newlib/libm/common/s_isinf.c @@ -0,0 +1,29 @@ +/* + * isinf(x) returns 1 if x is infinity, else 0; + * no branching! + * + * isinf is a <math.h> macro in the C99 standard. It was previously + * implemented as a function by newlib and is declared as such in + * <ieeefp.h>. Newlib supplies it here as a function if the user + * chooses to use <ieeefp.h> or needs to link older code compiled with the + * previous <math.h> declaration. + */ + +#include "fdlibm.h" +#include <ieeefp.h> + +#ifndef _DOUBLE_IS_32BITS + +int +_DEFUN (isinf, (x), + double x) +{ + __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/common/s_isinfd.c b/newlib/libm/common/s_isinfd.c new file mode 100644 index 0000000..5a2b04d --- /dev/null +++ b/newlib/libm/common/s_isinfd.c @@ -0,0 +1,23 @@ +/* + * __isinfd(x) returns 1 if x is infinity, else 0; + * no branching! + * Added by Cygnus Support. + */ + +#include "fdlibm.h" + +#ifndef _DOUBLE_IS_32BITS + +int +_DEFUN (__isinfd, (x), + double x) +{ + __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/common/s_isnan.c b/newlib/libm/common/s_isnan.c new file mode 100644 index 0000000..b0c4036 --- /dev/null +++ b/newlib/libm/common/s_isnan.c @@ -0,0 +1,135 @@ + +/* @(#)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 + A 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>> functions perform the same + operations as their <<isnan>>, <<isinf>> and <<finite>> + counterparts, but on single-precision floating-point numbers. + + It should be noted that the C99 standard dictates that <<isnan>> + and <<isinf>> are macros that operate on multiple types of + floating-point. The SUSv2 standard declares <<isnan>> as + a function taking double. Newlib has decided to declare + them both as macros in math.h and as functions in ieeefp.h. + +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! + * + * The C99 standard dictates that isnan is a macro taking + * multiple floating-point types while the SUSv2 standard + * notes it is a function taking a double argument. Newlib + * has chosen to implement it as a macro in <math.h> and + * declare it as a function in <ieeefp.h>. + */ + +#include "fdlibm.h" +#include <ieeefp.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/common/s_isnand.c b/newlib/libm/common/s_isnand.c new file mode 100644 index 0000000..75538d9 --- /dev/null +++ b/newlib/libm/common/s_isnand.c @@ -0,0 +1,122 @@ +/* + * ==================================================== + * 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 + A 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. + + Note that by the C99 standard, <<isnan>> and <<isinf>> are macros + taking any type of floating-point and are declared in + <<math.h>>. Newlib has chosen to declare these as macros in + <<math.h>> and as functions in <<ieeefp.h>>. + + The <<isnanf>>, <<isinff>> and <<finitef>> functions 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 +*/ + +/* + * __isnand(x) returns 1 is x is nan, else 0; + * no branching! + */ + +#include "fdlibm.h" + +#ifndef _DOUBLE_IS_32BITS + +int +_DEFUN (__isnand, (x), + double x) +{ + __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/common/sf_isinf.c b/newlib/libm/common/sf_isinf.c new file mode 100644 index 0000000..9ee60c0 --- /dev/null +++ b/newlib/libm/common/sf_isinf.c @@ -0,0 +1,29 @@ +/* + * isinff(x) returns 1 if x is +-infinity, else 0; + * + * isinff is an extension declared in <ieeefp.h> and + * <math.h>. + */ + +#include "fdlibm.h" + +int +_DEFUN (isinff, (x), + float x) +{ + __int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; + return FLT_UWORD_IS_INFINITE(ix); +} + +#ifdef _DOUBLE_IS_32BITS + +int +_DEFUN (isinf, (x), + double x) +{ + return isinff((float) x); +} + +#endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/newlib/libm/common/sf_isinff.c b/newlib/libm/common/sf_isinff.c new file mode 100644 index 0000000..9d0e742 --- /dev/null +++ b/newlib/libm/common/sf_isinff.c @@ -0,0 +1,27 @@ +/* + * __isinff(x) returns 1 if x is +-infinity, else 0; + * Added by Cygnus Support. + */ + +#include "fdlibm.h" + +int +_DEFUN (__isinff, (x), + float x) +{ + __int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; + return FLT_UWORD_IS_INFINITE(ix); +} + +#ifdef _DOUBLE_IS_32BITS + +int +_DEFUN (__isinfd, (x), + double x) +{ + return __isinff((float) x); +} + +#endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/newlib/libm/common/sf_isnan.c b/newlib/libm/common/sf_isnan.c new file mode 100644 index 0000000..e010051 --- /dev/null +++ b/newlib/libm/common/sf_isnan.c @@ -0,0 +1,42 @@ +/* sf_c_isnan.c -- float version of s_c_isnan.c. + */ + +/* + * ==================================================== + * 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; + * + * isnanf is an extension declared in <ieeefp.h> and <math.h>. + */ + +#include "fdlibm.h" + +int +_DEFUN (isnanf, (x), + float x) +{ + __int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; + return FLT_UWORD_IS_NAN(ix); +} + +#ifdef _DOUBLE_IS_32BITS + +int +_DEFUN (isnan, (x), + double x) +{ + return isnanf((float) x); +} + +#endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/newlib/libm/common/sf_isnanf.c b/newlib/libm/common/sf_isnanf.c new file mode 100644 index 0000000..0b0d9bb --- /dev/null +++ b/newlib/libm/common/sf_isnanf.c @@ -0,0 +1,37 @@ +/* + * ==================================================== + * 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" + +int +_DEFUN (__isnanf, (x), + float x) +{ + __int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; + return FLT_UWORD_IS_NAN(ix); +} + +#ifdef _DOUBLE_IS_32BITS + +int +_DEFUN (__isnand, (x), + double x) +{ + return __isnanf((float) x); +} + +#endif /* defined(_DOUBLE_IS_32BITS) */ |