OSDN Git Service

2009-07-09 Craig Howland <howland@LGSInnovations.com>
authorjjohnstn <jjohnstn>
Thu, 9 Jul 2009 17:04:55 +0000 (17:04 +0000)
committerjjohnstn <jjohnstn>
Thu, 9 Jul 2009 17:04:55 +0000 (17:04 +0000)
        * libm/math/ef_scalb.c:  Replace isnanf() (pre-C99 function call) with
        isnan() (C99 macro).
        * libm/math/wf_log.c:  Ditto.
        * libm/math/wf_j0.c:  Ditto.
        * libm/math/wf_sqrt.c:  Ditto.
        * libm/math/wf_pow.c:  Ditto.
        * libm/math/wf_fmod.c:  Ditto.
        * libm/math/wf_remainder.c:  Ditto.
        * libm/math/wf_scalb.c:  Ditto.
        * libm/math/wf_atanh.c:  Ditto.
        * libm/math/wf_cosh.c:  Ditto.
        * libm/math/wf_acos.c:  Ditto.
        * libm/math/wf_acosh.c:  Ditto.
        * libm/math/wf_jn.c:  Ditto.
        * libm/math/wf_log10.c:  Ditto.
        * libm/math/wf_asin.c:  Ditto.
        * libm/math/wf_j1.c:  Ditto.
        * libm/common/sf_isnan.c:  Add #include <ieeefp.h>, fix comment.
        * libm/common/sf_isinf.c:  Add #include <ieeefp.h>, adjust comment to
        match that from s_isinf.c.
        * libc/include/machine/ieeefp.h:  Simplify isinf and isnan macros to
        remove un-necessary extension use (in a similar manner to as was
        recently done in math.h).
        * libc/include/math.h:  Remove isnanf and isinff prototypes (are in
        ieeefp.h).
        * libm/machine/spu/sf_isinf.c:  Fix comment (remove <math.h>).

22 files changed:
newlib/ChangeLog
newlib/libc/include/machine/ieeefp.h
newlib/libc/include/math.h
newlib/libm/common/sf_isinf.c
newlib/libm/common/sf_isnan.c
newlib/libm/machine/spu/sf_isinf.c
newlib/libm/math/ef_scalb.c
newlib/libm/math/wf_acos.c
newlib/libm/math/wf_acosh.c
newlib/libm/math/wf_asin.c
newlib/libm/math/wf_atanh.c
newlib/libm/math/wf_cosh.c
newlib/libm/math/wf_fmod.c
newlib/libm/math/wf_j0.c
newlib/libm/math/wf_j1.c
newlib/libm/math/wf_jn.c
newlib/libm/math/wf_log.c
newlib/libm/math/wf_log10.c
newlib/libm/math/wf_pow.c
newlib/libm/math/wf_remainder.c
newlib/libm/math/wf_scalb.c
newlib/libm/math/wf_sqrt.c

index 222b8a8..47b6c0f 100644 (file)
@@ -1,3 +1,32 @@
+2009-07-09  Craig Howland <howland@LGSInnovations.com>
+
+       * libm/math/ef_scalb.c:  Replace isnanf() (pre-C99 function call) with
+       isnan() (C99 macro).
+       * libm/math/wf_log.c:  Ditto.
+       * libm/math/wf_j0.c:  Ditto.
+       * libm/math/wf_sqrt.c:  Ditto.
+       * libm/math/wf_pow.c:  Ditto.
+       * libm/math/wf_fmod.c:  Ditto.
+       * libm/math/wf_remainder.c:  Ditto.
+       * libm/math/wf_scalb.c:  Ditto.
+       * libm/math/wf_atanh.c:  Ditto.
+       * libm/math/wf_cosh.c:  Ditto.
+       * libm/math/wf_acos.c:  Ditto.
+       * libm/math/wf_acosh.c:  Ditto.
+       * libm/math/wf_jn.c:  Ditto.
+       * libm/math/wf_log10.c:  Ditto.
+       * libm/math/wf_asin.c:  Ditto.
+       * libm/math/wf_j1.c:  Ditto.
+       * libm/common/sf_isnan.c:  Add #include <ieeefp.h>, fix comment.
+       * libm/common/sf_isinf.c:  Add #include <ieeefp.h>, adjust comment to
+       match that from s_isinf.c.
+       * libc/include/machine/ieeefp.h:  Simplify isinf and isnan macros to
+       remove un-necessary extension use (in a similar manner to as was
+       recently done in math.h).
+       * libc/include/math.h:  Remove isnanf and isinff prototypes (are in
+       ieeefp.h).
+       * libm/machine/spu/sf_isinf.c:  Fix comment (remove <math.h>).
+
 2009-07-06  Joel Sherrill <joel.sherrill@oarcorp.com>
 
        * libc/include/sys/features.h: Enable UNIX98 mutex attributes
index 531a20c..7b6280f 100644 (file)
           (__extension__ ({__typeof__(y) __y = (y); \
                            (sizeof (__y) == sizeof (float))  ? (1) : \
                            fpclassify(__y) != FP_INFINITE && fpclassify(__y) != FP_NAN;}))
-#define isinf(x) \
-          (__extension__ ({__typeof__(x) __x = (x); \
-                           (sizeof (__x) == sizeof (float))  ? (0) : __isinfd(__x);}))
-#define isnan(x) \
-          (__extension__ ({__typeof__(x) __x = (x); \
-                           (sizeof (__x) == sizeof (float))  ? (0) : __isnand(__x);}))
+#define isinf(__x) ((sizeof (__x) == sizeof (float))  ?  (0) : __isinfd(__x))
+#define isnan(__x) ((sizeof (__x) == sizeof (float))  ?  (0) : __isnand(__x))
 
 /*
  * Macros for use in ieeefp.h. We can't just define the real ones here
index ca65a44..c1bc7b0 100644 (file)
@@ -195,7 +195,8 @@ extern int __signbitd (double x);
  *       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.  */
+ *       taking double arguments still exist for compatibility purposes
+ *       (prototypes for them are in <ieeefp.h>).  */
 #ifndef isinf
   #define isinf(y) (fpclassify(y) == FP_INFINITE)
 #endif
@@ -329,8 +330,6 @@ extern float fmaf _PARAMS((float, float, float));
 
 extern float infinityf _PARAMS((void));
 extern float nanf _PARAMS((const char *));
-extern int isnanf _PARAMS((float));
-extern int isinff _PARAMS((float));
 extern int finitef _PARAMS((float));
 extern float copysignf _PARAMS((float, float));
 extern int ilogbf _PARAMS((float));
index 74ba4ed..6595a68 100644 (file)
@@ -1,11 +1,17 @@
 /*
  * isinff(x) returns 1 if x is +-infinity, else 0;
  *
- * isinff is an extension declared in <ieeefp.h> and
- * <math.h>.
+ * isinf is a <math.h> macro in the C99 standard.  It was previously
+ * implemented as isinf and isinff functions by newlib and are still 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>
+
+#undef isinff
 
 int
 _DEFUN (isinff, (x),
index befc3b2..ddda6b3 100644 (file)
 /*
  * isnanf(x) returns 1 is x is nan, else 0;
  *
- * isnanf is an extension declared in <ieeefp.h> and <math.h>.
+ * isnanf is an extension declared in <ieeefp.h>.
  */
 
 #include "fdlibm.h"
+#include <ieeefp.h>
+#undef isnanf
 
 int
 _DEFUN (isnanf, (x),
index 7cba324..3c5f8d8 100644 (file)
@@ -34,7 +34,7 @@
 /*
  * On the SPU isinff(x) always returns 0.
  *
- * isinff is an extension declared in <ieeefp.h> and <math.h>.
+ * isinff is an extension declared in <ieeefp.h>.
  */
 int
 isinff (float x)
index 3677a3b..8d973b1 100644 (file)
@@ -35,7 +35,7 @@
 #ifdef _SCALB_INT
        return scalbnf(x,fn);
 #else
-       if (isnanf(x)||isnanf(fn)) return x*fn;
+       if (isnan(x)||isnan(fn)) return x*fn;
        if (!finitef(fn)) {
            if(fn>(float)0.0) return x*fn;
            else       return x/(-fn);
index 38817b8..ff9f80b 100644 (file)
@@ -33,7 +33,7 @@
        float z;
        struct exception exc;
        z = __ieee754_acosf(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(fabsf(x)>(float)1.0) {
            /* acosf(|x|>1) */
            exc.type = DOMAIN;
index 19c2450..fc8ec3a 100644 (file)
@@ -34,7 +34,7 @@
        float z;
        struct exception exc;
        z = __ieee754_acoshf(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(x<(float)1.0) {
             /* acoshf(x<1) */
             exc.type = DOMAIN;
index fc39e97..385de54 100644 (file)
@@ -35,7 +35,7 @@
        float z;
        struct exception exc;
        z = __ieee754_asinf(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(fabsf(x)>(float)1.0) {
            /* asinf(|x|>1) */
            exc.type = DOMAIN;
index 457cdc6..5656304 100644 (file)
@@ -32,7 +32,7 @@
        float z,y;
        struct exception exc;
        z = __ieee754_atanhf(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        y = fabsf(x);
        if(y>=(float)1.0) {
            if(y>(float)1.0) {
index 82b76f3..02eb124 100644 (file)
@@ -33,7 +33,7 @@
        float z;
        struct exception exc;
        z = __ieee754_coshf(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(fabsf(x)>(float)8.9415985107e+01) {  
            /* coshf(finite) overflow */
 #ifndef HUGE_VAL
index 320daab..030ca3e 100644 (file)
@@ -33,7 +33,7 @@
        float z;
        struct exception exc;
        z = __ieee754_fmodf(x,y);
-       if(_LIB_VERSION == _IEEE_ ||isnanf(y)||isnanf(x)) return z;
+       if(_LIB_VERSION == _IEEE_ ||isnan(y)||isnan(x)) return z;
        if(y==(float)0.0) {
             /* fmodf(x,0) */
             exc.type = DOMAIN;
index 0f3a7c1..1f7f5ed 100644 (file)
@@ -32,7 +32,7 @@
 #else
        struct exception exc;
        float z = __ieee754_j0f(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(fabsf(x)>(float)X_TLOSS) {
            /* j0f(|x|>X_TLOSS) */
             exc.type = TLOSS;
@@ -66,7 +66,7 @@
        float z;
        struct exception exc;
        z = __ieee754_y0f(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
         if(x <= (float)0.0){
 #ifndef HUGE_VAL 
 #define HUGE_VAL inf
index f9d3e0e..b919628 100644 (file)
@@ -34,7 +34,7 @@
        float z;
        struct exception exc;
        z = __ieee754_j1f(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
        if(fabsf(x)>(float)X_TLOSS) {
            /* j1f(|x|>X_TLOSS) */
             exc.type = TLOSS;
@@ -68,7 +68,7 @@
        float z;
        struct exception exc;
        z = __ieee754_y1f(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
         if(x <= (float)0.0){
            /* y1f(0) = -inf or y1f(x<0) = NaN */
 #ifndef HUGE_VAL 
index c3a5263..837b6b7 100644 (file)
@@ -30,7 +30,7 @@
        float z;
        struct exception exc;
        z = __ieee754_jnf(n,x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
        if(fabsf(x)>(float)X_TLOSS) {
            /* jnf(|x|>X_TLOSS) */
             exc.type = TLOSS;
@@ -65,7 +65,7 @@
        float z;
        struct exception exc;
        z = __ieee754_ynf(n,x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
         if(x <= (float)0.0){
            /* ynf(n,0) = -inf or ynf(x<0) = NaN */
 #ifndef HUGE_VAL 
index 989eeb3..4518b86 100644 (file)
@@ -33,7 +33,7 @@
        float z;
        struct exception exc;
        z = __ieee754_logf(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x) || x > (float)0.0) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x) || x > (float)0.0) return z;
 #ifndef HUGE_VAL 
 #define HUGE_VAL inf
        double inf = 0.0;
index 41dd93a..11c5956 100644 (file)
@@ -33,7 +33,7 @@
        float z;
        struct exception exc;
        z = __ieee754_log10f(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(x<=(float)0.0) {
 #ifndef HUGE_VAL 
 #define HUGE_VAL inf
index eaeed85..a30f880 100644 (file)
@@ -33,8 +33,8 @@
        float z;
        struct exception exc;
        z=__ieee754_powf(x,y);
-       if(_LIB_VERSION == _IEEE_|| isnanf(y)) return z;
-       if(isnanf(x)) {
+       if(_LIB_VERSION == _IEEE_|| isnan(y)) return z;
+       if(isnan(x)) {
            if(y==(float)0.0) { 
                /* powf(NaN,0.0) */
                /* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */
@@ -97,7 +97,7 @@
        }
        if(!finitef(z)) {
            if(finitef(x)&&finitef(y)) {
-               if(isnanf(z)) {
+               if(isnan(z)) {
                    /* neg**non-integral */
                    exc.type = DOMAIN;
                    exc.name = "powf";
index 0071a97..f38c237 100644 (file)
@@ -33,7 +33,7 @@
        float z;
        struct exception exc;
        z = __ieee754_remainderf(x,y);
-       if(_LIB_VERSION == _IEEE_ || isnanf(y)) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(y)) return z;
        if(y==(float)0.0) { 
             /* remainderf(x,0) */
             exc.type = DOMAIN;
index bd2d9f8..d2c3cd2 100644 (file)
@@ -50,7 +50,7 @@
        struct exception exc;
        z = __ieee754_scalbf(x,fn);
        if(_LIB_VERSION == _IEEE_) return z;
-       if(!(finitef(z)||isnanf(z))&&finitef(x)) {
+       if(!(finitef(z)||isnan(z))&&finitef(x)) {
            /* scalbf overflow; SVID also returns +-HUGE_VAL */
            exc.type = OVERFLOW;
            exc.name = "scalbf";
index 6e792c9..4536ba0 100644 (file)
@@ -33,7 +33,7 @@
        float z;
        struct exception exc;
        z = __ieee754_sqrtf(x);
-       if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
+       if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(x<(float)0.0) {
             /* sqrtf(negative) */
             exc.type = DOMAIN;