+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
(__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
* 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
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));
/*
* 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),
/*
* 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),
/*
* 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)
#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);
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;
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;
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;
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) {
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
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;
#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;
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
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;
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
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;
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
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;
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
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_ */
}
if(!finitef(z)) {
if(finitef(x)&&finitef(y)) {
- if(isnanf(z)) {
+ if(isnan(z)) {
/* neg**non-integral */
exc.type = DOMAIN;
exc.name = "powf";
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;
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";
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;