Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2006-02-28 02:51:28 +0300
committerJeff Johnston <jjohnstn@redhat.com>2006-02-28 02:51:28 +0300
commite48682cff514c0480aff58a3e752edf7eb9ff228 (patch)
tree0e9c096a2b54e60d287d32cec39017b36714871c /newlib/libc/include/math.h
parent47a5b664e5095434abe0630008fce5dc9f323130 (diff)
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/libc/include/math.h')
-rw-r--r--newlib/libc/include/math.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index 041e8000b..41ce752b3 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -1,4 +1,3 @@
-/* math.h -- Definitions for the math floating point package. */
#ifndef _MATH_H_
#define _MATH_H_
@@ -119,6 +118,10 @@ typedef double double_t;
#define FP_SUBNORMAL 3
#define FP_NORMAL 4
+extern int __isinff (float x);
+extern int __isinfd (double x);
+extern int __isnanf (float x);
+extern int __isnand (double x);
extern int __fpclassifyf (float x);
extern int __fpclassifyd (double x);
extern int __signbitf (float x);
@@ -131,9 +134,19 @@ extern int __signbitd (double x);
#define isfinite(y) \
(__extension__ ({__typeof__(y) __y = (y); \
fpclassify(__y) != FP_INFINITE && fpclassify(__y) != FP_NAN;}))
-#define isnormal(z) \
- (__extension__ ({__typeof__(z) __z = (z); \
- fpclassify(__z) == FP_NORMAL;}))
+
+/* Note: isinf and isnan were once functions in newlib that took double
+ * arguments. C99 specifies that these names are reserved for macros
+ * supporting multiple floating point types. Thus, they are
+ * now defined as macros. Implementations of the old functions
+ * taking double arguments still exist for compatibility purposes. */
+#define isinf(x) \
+ (__extension__ ({__typeof__(x) __x = (x); \
+ (sizeof (__x) == sizeof (float)) ? __isinff(__x) : __isinfd(__x);}))
+#define isnan(x) \
+ (__extension__ ({__typeof__(x) __x = (x); \
+ (sizeof (__x) == sizeof (float)) ? __isnanf(__x) : __isnand(__x);}))
+#define isnormal(y) (fpclassify(y) == FP_NORMAL)
#define signbit(x) \
(__extension__ ({__typeof__(x) __x = (x); \
(sizeof(__x) == sizeof(float)) ? __signbitf(__x) : __signbitd(__x);}))
@@ -162,8 +175,6 @@ extern int __signbitd (double x);
extern double infinity _PARAMS((void));
extern double nan _PARAMS((const char *));
-extern int isnan _PARAMS((double));
-extern int isinf _PARAMS((double));
extern int finite _PARAMS((double));
extern double copysign _PARAMS((double, double));
extern int ilogb _PARAMS((double));