summaryrefslogtreecommitdiffstats
path: root/newlib/libm/common/s_isnand.c
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2006-02-27 23:51:28 +0000
committerJeff Johnston <jjohnstn@redhat.com>2006-02-27 23:51:28 +0000
commite48682cff514c0480aff58a3e752edf7eb9ff228 (patch)
tree0e9c096a2b54e60d287d32cec39017b36714871c /newlib/libm/common/s_isnand.c
parent47a5b664e5095434abe0630008fce5dc9f323130 (diff)
downloadcygnal-e48682cff514c0480aff58a3e752edf7eb9ff228.tar.gz
cygnal-e48682cff514c0480aff58a3e752edf7eb9ff228.tar.bz2
cygnal-e48682cff514c0480aff58a3e752edf7eb9ff228.zip
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/s_isnand.c')
-rw-r--r--newlib/libm/common/s_isnand.c122
1 files changed, 122 insertions, 0 deletions
diff --git a/newlib/libm/common/s_isnand.c b/newlib/libm/common/s_isnand.c
new file mode 100644
index 000000000..75538d907
--- /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 */