mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-31 11:30:56 +08:00
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>).
This commit is contained in:
parent
b2cbcab19f
commit
664f00763b
@ -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>
|
2009-07-06 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
* libc/include/sys/features.h: Enable UNIX98 mutex attributes
|
* libc/include/sys/features.h: Enable UNIX98 mutex attributes
|
||||||
|
@ -80,12 +80,8 @@
|
|||||||
(__extension__ ({__typeof__(y) __y = (y); \
|
(__extension__ ({__typeof__(y) __y = (y); \
|
||||||
(sizeof (__y) == sizeof (float)) ? (1) : \
|
(sizeof (__y) == sizeof (float)) ? (1) : \
|
||||||
fpclassify(__y) != FP_INFINITE && fpclassify(__y) != FP_NAN;}))
|
fpclassify(__y) != FP_INFINITE && fpclassify(__y) != FP_NAN;}))
|
||||||
#define isinf(x) \
|
#define isinf(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isinfd(__x))
|
||||||
(__extension__ ({__typeof__(x) __x = (x); \
|
#define isnan(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isnand(__x))
|
||||||
(sizeof (__x) == sizeof (float)) ? (0) : __isinfd(__x);}))
|
|
||||||
#define isnan(x) \
|
|
||||||
(__extension__ ({__typeof__(x) __x = (x); \
|
|
||||||
(sizeof (__x) == sizeof (float)) ? (0) : __isnand(__x);}))
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Macros for use in ieeefp.h. We can't just define the real ones here
|
* Macros for use in ieeefp.h. We can't just define the real ones here
|
||||||
|
@ -195,7 +195,8 @@ extern int __signbitd (double x);
|
|||||||
* arguments. C99 specifies that these names are reserved for macros
|
* arguments. C99 specifies that these names are reserved for macros
|
||||||
* supporting multiple floating point types. Thus, they are
|
* supporting multiple floating point types. Thus, they are
|
||||||
* now defined as macros. Implementations of the old functions
|
* 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
|
#ifndef isinf
|
||||||
#define isinf(y) (fpclassify(y) == FP_INFINITE)
|
#define isinf(y) (fpclassify(y) == FP_INFINITE)
|
||||||
#endif
|
#endif
|
||||||
@ -329,8 +330,6 @@ extern float fmaf _PARAMS((float, float, float));
|
|||||||
|
|
||||||
extern float infinityf _PARAMS((void));
|
extern float infinityf _PARAMS((void));
|
||||||
extern float nanf _PARAMS((const char *));
|
extern float nanf _PARAMS((const char *));
|
||||||
extern int isnanf _PARAMS((float));
|
|
||||||
extern int isinff _PARAMS((float));
|
|
||||||
extern int finitef _PARAMS((float));
|
extern int finitef _PARAMS((float));
|
||||||
extern float copysignf _PARAMS((float, float));
|
extern float copysignf _PARAMS((float, float));
|
||||||
extern int ilogbf _PARAMS((float));
|
extern int ilogbf _PARAMS((float));
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* isinff(x) returns 1 if x is +-infinity, else 0;
|
* isinff(x) returns 1 if x is +-infinity, else 0;
|
||||||
*
|
*
|
||||||
* isinff is an extension declared in <ieeefp.h> and
|
* isinf is a <math.h> macro in the C99 standard. It was previously
|
||||||
* <math.h>.
|
* 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 "fdlibm.h"
|
||||||
|
#include <ieeefp.h>
|
||||||
|
|
||||||
|
#undef isinff
|
||||||
|
|
||||||
int
|
int
|
||||||
_DEFUN (isinff, (x),
|
_DEFUN (isinff, (x),
|
||||||
|
@ -15,10 +15,13 @@
|
|||||||
/*
|
/*
|
||||||
* isnanf(x) returns 1 is x is nan, else 0;
|
* 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 "fdlibm.h"
|
||||||
|
#include <ieeefp.h>
|
||||||
|
|
||||||
|
#undef isnanf
|
||||||
|
|
||||||
int
|
int
|
||||||
_DEFUN (isnanf, (x),
|
_DEFUN (isnanf, (x),
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
/*
|
/*
|
||||||
* On the SPU isinff(x) always returns 0.
|
* 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
|
int
|
||||||
isinff (float x)
|
isinff (float x)
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#ifdef _SCALB_INT
|
#ifdef _SCALB_INT
|
||||||
return scalbnf(x,fn);
|
return scalbnf(x,fn);
|
||||||
#else
|
#else
|
||||||
if (isnanf(x)||isnanf(fn)) return x*fn;
|
if (isnan(x)||isnan(fn)) return x*fn;
|
||||||
if (!finitef(fn)) {
|
if (!finitef(fn)) {
|
||||||
if(fn>(float)0.0) return x*fn;
|
if(fn>(float)0.0) return x*fn;
|
||||||
else return x/(-fn);
|
else return x/(-fn);
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_acosf(x);
|
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) {
|
if(fabsf(x)>(float)1.0) {
|
||||||
/* acosf(|x|>1) */
|
/* acosf(|x|>1) */
|
||||||
exc.type = DOMAIN;
|
exc.type = DOMAIN;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_acoshf(x);
|
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) {
|
if(x<(float)1.0) {
|
||||||
/* acoshf(x<1) */
|
/* acoshf(x<1) */
|
||||||
exc.type = DOMAIN;
|
exc.type = DOMAIN;
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_asinf(x);
|
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) {
|
if(fabsf(x)>(float)1.0) {
|
||||||
/* asinf(|x|>1) */
|
/* asinf(|x|>1) */
|
||||||
exc.type = DOMAIN;
|
exc.type = DOMAIN;
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
float z,y;
|
float z,y;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_atanhf(x);
|
z = __ieee754_atanhf(x);
|
||||||
if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
|
if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
|
||||||
y = fabsf(x);
|
y = fabsf(x);
|
||||||
if(y>=(float)1.0) {
|
if(y>=(float)1.0) {
|
||||||
if(y>(float)1.0) {
|
if(y>(float)1.0) {
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_coshf(x);
|
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) {
|
if(fabsf(x)>(float)8.9415985107e+01) {
|
||||||
/* coshf(finite) overflow */
|
/* coshf(finite) overflow */
|
||||||
#ifndef HUGE_VAL
|
#ifndef HUGE_VAL
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_fmodf(x,y);
|
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) {
|
if(y==(float)0.0) {
|
||||||
/* fmodf(x,0) */
|
/* fmodf(x,0) */
|
||||||
exc.type = DOMAIN;
|
exc.type = DOMAIN;
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#else
|
#else
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
float z = __ieee754_j0f(x);
|
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) {
|
if(fabsf(x)>(float)X_TLOSS) {
|
||||||
/* j0f(|x|>X_TLOSS) */
|
/* j0f(|x|>X_TLOSS) */
|
||||||
exc.type = TLOSS;
|
exc.type = TLOSS;
|
||||||
@ -66,7 +66,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_y0f(x);
|
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){
|
if(x <= (float)0.0){
|
||||||
#ifndef HUGE_VAL
|
#ifndef HUGE_VAL
|
||||||
#define HUGE_VAL inf
|
#define HUGE_VAL inf
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_j1f(x);
|
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) {
|
if(fabsf(x)>(float)X_TLOSS) {
|
||||||
/* j1f(|x|>X_TLOSS) */
|
/* j1f(|x|>X_TLOSS) */
|
||||||
exc.type = TLOSS;
|
exc.type = TLOSS;
|
||||||
@ -68,7 +68,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_y1f(x);
|
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){
|
if(x <= (float)0.0){
|
||||||
/* y1f(0) = -inf or y1f(x<0) = NaN */
|
/* y1f(0) = -inf or y1f(x<0) = NaN */
|
||||||
#ifndef HUGE_VAL
|
#ifndef HUGE_VAL
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_jnf(n,x);
|
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) {
|
if(fabsf(x)>(float)X_TLOSS) {
|
||||||
/* jnf(|x|>X_TLOSS) */
|
/* jnf(|x|>X_TLOSS) */
|
||||||
exc.type = TLOSS;
|
exc.type = TLOSS;
|
||||||
@ -65,7 +65,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_ynf(n,x);
|
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){
|
if(x <= (float)0.0){
|
||||||
/* ynf(n,0) = -inf or ynf(x<0) = NaN */
|
/* ynf(n,0) = -inf or ynf(x<0) = NaN */
|
||||||
#ifndef HUGE_VAL
|
#ifndef HUGE_VAL
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_logf(x);
|
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
|
#ifndef HUGE_VAL
|
||||||
#define HUGE_VAL inf
|
#define HUGE_VAL inf
|
||||||
double inf = 0.0;
|
double inf = 0.0;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_log10f(x);
|
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) {
|
if(x<=(float)0.0) {
|
||||||
#ifndef HUGE_VAL
|
#ifndef HUGE_VAL
|
||||||
#define HUGE_VAL inf
|
#define HUGE_VAL inf
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z=__ieee754_powf(x,y);
|
z=__ieee754_powf(x,y);
|
||||||
if(_LIB_VERSION == _IEEE_|| isnanf(y)) return z;
|
if(_LIB_VERSION == _IEEE_|| isnan(y)) return z;
|
||||||
if(isnanf(x)) {
|
if(isnan(x)) {
|
||||||
if(y==(float)0.0) {
|
if(y==(float)0.0) {
|
||||||
/* powf(NaN,0.0) */
|
/* powf(NaN,0.0) */
|
||||||
/* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */
|
/* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */
|
||||||
@ -97,7 +97,7 @@
|
|||||||
}
|
}
|
||||||
if(!finitef(z)) {
|
if(!finitef(z)) {
|
||||||
if(finitef(x)&&finitef(y)) {
|
if(finitef(x)&&finitef(y)) {
|
||||||
if(isnanf(z)) {
|
if(isnan(z)) {
|
||||||
/* neg**non-integral */
|
/* neg**non-integral */
|
||||||
exc.type = DOMAIN;
|
exc.type = DOMAIN;
|
||||||
exc.name = "powf";
|
exc.name = "powf";
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_remainderf(x,y);
|
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) {
|
if(y==(float)0.0) {
|
||||||
/* remainderf(x,0) */
|
/* remainderf(x,0) */
|
||||||
exc.type = DOMAIN;
|
exc.type = DOMAIN;
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_scalbf(x,fn);
|
z = __ieee754_scalbf(x,fn);
|
||||||
if(_LIB_VERSION == _IEEE_) return z;
|
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 */
|
/* scalbf overflow; SVID also returns +-HUGE_VAL */
|
||||||
exc.type = OVERFLOW;
|
exc.type = OVERFLOW;
|
||||||
exc.name = "scalbf";
|
exc.name = "scalbf";
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
float z;
|
float z;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
z = __ieee754_sqrtf(x);
|
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) {
|
if(x<(float)0.0) {
|
||||||
/* sqrtf(negative) */
|
/* sqrtf(negative) */
|
||||||
exc.type = DOMAIN;
|
exc.type = DOMAIN;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user