diff --git a/amd64/bsd_ieeefp.h b/amd64/bsd_ieeefp.h index edb0d9c..8a7ee20 100644 --- a/amd64/bsd_ieeefp.h +++ b/amd64/bsd_ieeefp.h @@ -38,10 +38,6 @@ #ifndef _MACHINE_IEEEFP_H_ #define _MACHINE_IEEEFP_H_ -#if !defined(_SYS_CDEFS_H) && !defined(_SYS_CDEFS_H_) && !defined(_CDEFS_H_) -#error this file needs sys/cdefs.h as a prerequisite -#endif - /* * FP rounding modes */ diff --git a/bsdsrc/b_exp.c b/bsdsrc/b_exp.c index 61c96eb..d71c7de 100644 --- a/bsdsrc/b_exp.c +++ b/bsdsrc/b_exp.c @@ -152,13 +152,13 @@ double x, c; c= x - z*(p1+z*(p2+z*(p3+z*(p4+z*p5)))); c = (x*c)/(2.0-c); - return scalb(1.+(hi-(lo - c)), k); + return scalbn(1.+(hi-(lo - c)), k); } /* end of x > lntiny */ else /* exp(-big#) underflows to zero */ - if(finite(x)) return(scalb(1.0,-5000)); + if(isfinite(x)) return(scalbn(1.0,-5000)); /* exp(-INF) is zero */ else return(0.0); @@ -167,5 +167,5 @@ double x, c; else /* exp(INF) is INF, exp(+big#) overflows to INF */ - return( finite(x) ? scalb(1.0,5000) : x); + return( isfinite(x) ? scalbn(1.0,5000) : x); } diff --git a/bsdsrc/b_tgamma.c b/bsdsrc/b_tgamma.c index 7380b1d..a5cfb0f 100644 --- a/bsdsrc/b_tgamma.c +++ b/bsdsrc/b_tgamma.c @@ -140,7 +140,7 @@ tgamma(x) if (x != 0.0) u.a = one - tiny; /* raise inexact */ return (one/x); - } else if (!finite(x)) + } else if (!isfinite(x)) return (x - x); /* x is NaN or -Inf */ else return (neg_gam(x)); diff --git a/include/cdefs-compat.h b/include/cdefs-compat.h index 173bc91..7c997c9 100644 --- a/include/cdefs-compat.h +++ b/include/cdefs-compat.h @@ -1,9 +1,11 @@ #ifndef _CDEFS_COMPAT_H_ #define _CDEFS_COMPAT_H_ -#ifndef _WIN32 -#include "sys/cdefs.h" -#else /* _WIN32 */ +/* + * We cannot be certain that this operating system has . + * Instead, include a header file that is likely to pull in this header. + */ +#include #if defined(__cplusplus) #define __BEGIN_DECLS extern "C" { @@ -13,13 +15,6 @@ #define __END_DECLS #endif -#define _SYS_CDEFS_H_ - -#endif /* _WIN32 */ - - - - #ifdef __GNUC__ #ifndef __strong_reference #ifdef __APPLE__ diff --git a/include/fpmath.h b/include/fpmath.h index 3b06b7e..5698b96 100644 --- a/include/fpmath.h +++ b/include/fpmath.h @@ -38,28 +38,37 @@ #endif #endif -#ifdef __linux +#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) + +/* Definitions provided directly by GCC and Clang. */ +#define _LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ +#define _BIG_ENDIAN __ORDER_BIG_ENDIAN__ +#define _PDP_ENDIAN __ORDER_PDP_ENDIAN__ +#define _BYTE_ORDER __BYTE_ORDER__ + +#elif defined(__linux) + #include #include #define _LITTLE_ENDIAN __LITTLE_ENDIAN #define _BIG_ENDIAN __BIG_ENDIAN #define _PDP_ENDIAN __PDP_ENDIAN #define _BYTE_ORDER __BYTE_ORDER -#endif -#ifdef __APPLE__ +#elif defined(__APPLE__) + #include #define _LITTLE_ENDIAN LITTLE_ENDIAN #define _BIG_ENDIAN BIG_ENDIAN #define _PDP_ENDIAN PDP_ENDIAN #define _BYTE_ORDER BYTE_ORDER -#endif -#ifdef __FreeBSD__ +#elif defined(__FreeBSD__) + #include -#endif -#ifdef _WIN32 +#elif defined(_WIN32) + #define _LITTLE_ENDIAN 1234 #define _BIG_ENDIAN 4321 #define _PDP_ENDIAN 3412 @@ -69,6 +78,7 @@ #define BIG_ENDIAN _BIG_ENDIAN #define PDP_ENDIAN _PDP_ENDIAN #define BYTE_ORDER _BYTE_ORDER + #endif #ifndef _IEEE_WORD_ORDER diff --git a/src/e_scalb.c b/src/e_scalb.c index d575100..e0c9165 100644 --- a/src/e_scalb.c +++ b/src/e_scalb.c @@ -35,7 +35,7 @@ __ieee754_scalb(double x, double fn) return scalbn(x,fn); #else if (isnan(x)||isnan(fn)) return x*fn; - if (!finite(fn)) { + if (!isfinite(fn)) { if(fn>0.0) return x*fn; else return x/(-fn); } diff --git a/src/e_scalbf.c b/src/e_scalbf.c index d506719..7472d37 100644 --- a/src/e_scalbf.c +++ b/src/e_scalbf.c @@ -30,8 +30,8 @@ __ieee754_scalbf(float x, float fn) #ifdef _SCALB_INT return scalbnf(x,fn); #else - if ((__isnanf)(x)||(__isnanf)(fn)) return x*fn; - if (!finitef(fn)) { + if (isnan(x)||isnan(fn)) return x*fn; + if (!isfinite(fn)) { if(fn>(float)0.0) return x*fn; else return x/(-fn); } diff --git a/src/math_private.h b/src/math_private.h index a8c0595..05d95c3 100644 --- a/src/math_private.h +++ b/src/math_private.h @@ -333,9 +333,7 @@ double __kernel_sin(double,double,int); double __kernel_cos(double,double); double __kernel_tan(double,double,int); double __ldexp_exp(double,int); -#ifdef _COMPLEX_H double complex __ldexp_cexp(double complex,int); -#endif /* float precision kernel functions */ #ifdef INLINE_REM_PIO2F @@ -355,9 +353,7 @@ __inline #endif float __kernel_tandf(double,int); float __ldexp_expf(float,int); -#ifdef _COMPLEX_H float complex __ldexp_cexpf(float complex,int); -#endif /* long double precision kernel functions */ long double __kernel_sinl(long double, long double, int); diff --git a/src/openlibm.h b/src/openlibm.h index 5bfd0af..5635612 100644 --- a/src/openlibm.h +++ b/src/openlibm.h @@ -57,7 +57,9 @@ extern const union __nan_un { //VBS begin #define __MATH_BUILTIN_CONSTANTS #define __MATH_BUILTIN_RELOPS +#ifndef __ISO_C_VISIBLE #define __ISO_C_VISIBLE 1999 +#endif //VBS end #ifdef __MATH_BUILTIN_CONSTANTS