about summary refs log tree commit diff
path: root/include/math.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-02-14 18:41:25 -0500
committerRich Felker <dalias@aerifal.cx>2011-02-14 18:41:25 -0500
commit74eea628cf43355ba2b227f0bb3c31697d637761 (patch)
tree9fe300db7b7fa7f541bdfa41176d0f6333851e74 /include/math.h
parent80695b1d1e64a026c473a33965e680444e863e34 (diff)
downloadmusl-74eea628cf43355ba2b227f0bb3c31697d637761.tar.gz
musl-74eea628cf43355ba2b227f0bb3c31697d637761.tar.xz
musl-74eea628cf43355ba2b227f0bb3c31697d637761.zip
extensive header cleanup for standards conformance & correctness
thanks to Peter Mazinger (psm) for pointing many of these issues out
and submitting a patch on which this commit is loosely based
Diffstat (limited to 'include/math.h')
-rw-r--r--include/math.h36
1 files changed, 19 insertions, 17 deletions
diff --git a/include/math.h b/include/math.h
index cc9befb7..fffdf4f7 100644
--- a/include/math.h
+++ b/include/math.h
@@ -6,20 +6,6 @@
 #define __NEED___uint64_t
 #include <bits/alltypes.h>
 
-#define M_E             2.7182818284590452354   /* e */
-#define M_LOG2E         1.4426950408889634074   /* log_2 e */
-#define M_LOG10E        0.43429448190325182765  /* log_10 e */
-#define M_LN2           0.69314718055994530942  /* log_e 2 */
-#define M_LN10          2.30258509299404568402  /* log_e 10 */
-#define M_PI            3.14159265358979323846  /* pi */
-#define M_PI_2          1.57079632679489661923  /* pi/2 */
-#define M_PI_4          0.78539816339744830962  /* pi/4 */
-#define M_1_PI          0.31830988618379067154  /* 1/pi */
-#define M_2_PI          0.63661977236758134308  /* 2/pi */
-#define M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */
-#define M_SQRT2         1.41421356237309504880  /* sqrt(2) */
-#define M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */
-
 #define __MAKE_FLOAT(i) (((union { int __i; float __f; }){ .__i = i }).__f)
 
 #define NAN       __MAKE_FLOAT(0x7fc00000)
@@ -286,15 +272,31 @@ double      trunc(double);
 float       truncf(float);
 long double truncl(long double);
 
-/* XSI stuff */
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
+#define M_E             2.7182818284590452354   /* e */
+#define M_LOG2E         1.4426950408889634074   /* log_2 e */
+#define M_LOG10E        0.43429448190325182765  /* log_10 e */
+#define M_LN2           0.69314718055994530942  /* log_e 2 */
+#define M_LN10          2.30258509299404568402  /* log_e 10 */
+#define M_PI            3.14159265358979323846  /* pi */
+#define M_PI_2          1.57079632679489661923  /* pi/2 */
+#define M_PI_4          0.78539816339744830962  /* pi/4 */
+#define M_1_PI          0.31830988618379067154  /* 1/pi */
+#define M_2_PI          0.63661977236758134308  /* 2/pi */
+#define M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */
+#define M_SQRT2         1.41421356237309504880  /* sqrt(2) */
+#define M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */
 double      j0(double);
 double      j1(double);
 double      jn(int, double);
-double      scalb(double, double);
 double      y0(double);
 double      y1(double);
 double      yn(int, double);
-
 extern int signgam;
+#endif
+
+#ifdef _GNU_SOURCE
+double      scalb(double, double);
+#endif
 
 #endif