diff options
Diffstat (limited to 'winsup/mingw/include/math.h')
-rw-r--r-- | winsup/mingw/include/math.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h index 0577d0cc2..82cd1ba43 100644 --- a/winsup/mingw/include/math.h +++ b/winsup/mingw/include/math.h @@ -354,11 +354,13 @@ typedef long double double_t; extern int __cdecl __fpclassifyf (float); extern int __cdecl __fpclassify (double); +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __fpclassifyl (long double x){ unsigned short sw; __asm__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x)); return sw & (FP_NAN | FP_NORMAL | FP_ZERO ); } +#endif #define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \ : sizeof (x) == sizeof (double) ? __fpclassify (x) \ @@ -373,7 +375,7 @@ __CRT_INLINE int __cdecl __fpclassifyl (long double x){ /* 7.12.3.4 */ /* We don't need to worry about truncation here: A NaN stays a NaN. */ - +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __isnan (double _x) { unsigned short sw; @@ -400,7 +402,7 @@ __CRT_INLINE int __cdecl __isnanl (long double _x) return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL)) == FP_NAN; } - +#endif #define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x) \ : sizeof (x) == sizeof (double) ? __isnan (x) \ @@ -410,6 +412,7 @@ __CRT_INLINE int __cdecl __isnanl (long double _x) #define isnormal(x) (fpclassify(x) == FP_NORMAL) /* 7.12.3.6 The signbit macro */ +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __signbit (double x) { unsigned short stw; __asm__ ( "fxam; fstsw %%ax;": "=a" (stw) : "t" (x)); @@ -427,6 +430,7 @@ __CRT_INLINE int __cdecl __signbitl (long double x) { __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x)); return (stw & 0x0200) != 0; } +#endif #define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \ : sizeof (x) == sizeof (double) ? __signbit (x) \ @@ -455,16 +459,22 @@ extern float __cdecl atan2f (float, float); extern long double __cdecl atan2l (long double, long double); /* 7.12.5 Hyperbolic functions: Double in C89 */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl sinhf (float x) {return (float) sinh (x);} +#endif extern long double __cdecl sinhl (long double); +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl coshf (float x) {return (float) cosh (x);} +#endif extern long double __cdecl coshl (long double); +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl tanhf (float x) {return (float) tanh (x);} +#endif extern long double __cdecl tanhl (long double); /* Inverse hyperbolic trig functions */ @@ -485,8 +495,10 @@ extern long double __cdecl atanhl (long double); /* Exponentials and logarithms */ /* 7.12.6.1 Double in C89 */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl expf (float x) {return (float) exp (x);} +#endif extern long double __cdecl expl (long double); /* 7.12.6.2 */ @@ -501,8 +513,10 @@ extern float __cdecl expm1f(float); extern long double __cdecl expm1l(long double); /* 7.12.6.4 Double in C89 */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl frexpf (float x, int* expn) {return (float) frexp (x, expn);} +#endif extern long double __cdecl frexpl (long double, int*); /* 7.12.6.5 */ @@ -513,8 +527,10 @@ extern int __cdecl ilogbf (float); extern int __cdecl ilogbl (long double); /* 7.12.6.6 Double in C89 */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl ldexpf (float x, int expn) {return (float) ldexp (x, expn);} +#endif extern long double __cdecl ldexpl (long double, int); /* 7.12.6.7 Double in C89 */ @@ -542,6 +558,7 @@ extern long double __cdecl logbl (long double); /* Inline versions. GCC-4.0+ can do a better fast-math optimization with __builtins. */ +#ifndef __NO_INLINE__ #if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ ) __CRT_INLINE double __cdecl logb (double x) { @@ -567,6 +584,7 @@ __CRT_INLINE long double __cdecl logbl (long double x) return res; } #endif /* !defined __FAST_MATH__ || !__MINGW_GNUC_PREREQ (4, 0) */ +#endif /* !defined __NO_INLINE__ */ /* 7.12.6.12 Double in C89 */ extern float __cdecl modff (float, float*); @@ -593,13 +611,17 @@ extern long double __cdecl fabsl (long double x); /* 7.12.7.3 */ extern double __cdecl hypot (double, double); /* in libmoldname.a */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl hypotf (float x, float y) { return (float) hypot (x, y);} +#endif extern long double __cdecl hypotl (long double, long double); /* 7.12.7.4 The pow functions. Double in C89 */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl powf (float x, float y) {return (float) pow (x, y);} +#endif extern long double __cdecl powl (long double, long double); /* 7.12.7.5 The sqrt functions. Double in C89. */ @@ -656,6 +678,7 @@ extern long long __cdecl llrintl (long double); /* Inline versions of above. GCC 4.0+ can do a better fast-math job with __builtins. */ +#ifndef __NO_INLINE__ #if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ ) __CRT_INLINE double __cdecl rint (double x) { @@ -726,6 +749,7 @@ __CRT_INLINE long long __cdecl llrintl (long double x) return retval; } #endif /* !__FAST_MATH__ || !__MINGW_GNUC_PREREQ (4,0) */ +#endif /* !defined __NO_INLINE */ /* 7.12.9.6 */ /* round away from zero, regardless of fpu control word settings */ @@ -836,6 +860,7 @@ extern long double __cdecl fmal (long double, long double, long double); #else /* helper */ +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __fp_unordered_compare (long double x, long double y){ unsigned short retval; @@ -843,6 +868,7 @@ __fp_unordered_compare (long double x, long double y){ "fnstsw;": "=a" (retval) : "t" (x), "u" (y)); return retval; } +#endif #define isgreater(x, y) ((__fp_unordered_compare(x, y) \ & 0x4500) == 0) |