math: add dummy implementations of 128 bit long double functions
authorSzabolcs Nagy <nsz@port70.net>
Tue, 10 Mar 2015 20:01:20 +0000 (20:01 +0000)
committerRich Felker <dalias@aerifal.cx>
Wed, 11 Mar 2015 22:54:53 +0000 (18:54 -0400)
This is in preparation for the aarch64 port only to have the long
double math symbols available on ld128 platforms. The implementations
should be fixed up later once we have proper tests for these functions.

Added bigendian handling for ld128 bit manipulations too.

17 files changed:
src/internal/libm.h
src/math/acoshl.c
src/math/asinhl.c
src/math/atanhl.c
src/math/coshl.c
src/math/erfl.c
src/math/expl.c
src/math/expm1l.c
src/math/lgammal.c
src/math/log10l.c
src/math/log1pl.c
src/math/log2l.c
src/math/logl.c
src/math/powl.c
src/math/sinhl.c
src/math/tanhl.c
src/math/tgammal.c

index 88a7eb4..df86411 100644 (file)
@@ -42,6 +42,20 @@ union ldshape {
                uint64_t hi;
        } i2;
 };
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __BIG_ENDIAN
+union ldshape {
+       long double f;
+       struct {
+               uint16_t se;
+               uint16_t top;
+               uint32_t mid;
+               uint64_t lo;
+       } i;
+       struct {
+               uint64_t hi;
+               uint64_t lo;
+       } i2;
+};
 #else
 #error Unsupported long double representation
 #endif
index 4aa84ac..8d4b43f 100644 (file)
@@ -20,4 +20,10 @@ long double acoshl(long double x)
                return logl(2*x - 1/(x+sqrtl(x*x-1)));
        return logl(x) + 0.693147180559945309417232121458176568L;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double acoshl(long double x)
+{
+       return acosh(x);
+}
 #endif
index e5f3175..8635f52 100644 (file)
@@ -32,4 +32,10 @@ long double asinhl(long double x)
        }
        return s ? -x : x;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double asinhl(long double x)
+{
+       return asinh(x);
+}
 #endif
index f63d60b..87cd1cd 100644 (file)
@@ -5,7 +5,7 @@ long double atanhl(long double x)
 {
        return atanh(x);
 }
-#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384
+#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
 /* atanh(x) = log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2 ~= x + x^3/3 + o(x^5) */
 long double atanhl(long double x)
 {
index 080e5eb..06a56fe 100644 (file)
@@ -38,4 +38,10 @@ long double coshl(long double x)
        t = expl(0.5*x);
        return 0.5*t*t;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double coshl(long double x)
+{
+       return cosh(x);
+}
 #endif
index 96b74de..e267c23 100644 (file)
@@ -340,4 +340,14 @@ long double erfcl(long double x)
        y = 0x1p-16382L;
        return sign ? 2 - y : y*y;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double erfl(long double x)
+{
+       return erf(x);
+}
+long double erfcl(long double x)
+{
+       return erfc(x);
+}
 #endif
index b62980f..0a7f44f 100644 (file)
@@ -119,4 +119,10 @@ long double expl(long double x)
        x = 1.0 + 2.0 * x;
        return scalbnl(x, k);
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double expl(long double x)
+{
+       return exp(x);
+}
 #endif
index 21a86c0..d171507 100644 (file)
@@ -114,4 +114,10 @@ long double expm1l(long double x)
        x = px * qx + (px - 1.0);
        return x;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double expm1l(long double x)
+{
+       return expm1(x);
+}
 #endif
index 55ec532..2b354a7 100644 (file)
@@ -340,9 +340,16 @@ long double __lgammal_r(long double x, int *sg) {
                r = nadj - r;
        return r;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+double __lgamma_r(double x, int *sg);
+
+long double __lgammal_r(long double x, int *sg)
+{
+       return __lgamma_r(x, sg);
+}
 #endif
 
-#if (LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024) || (LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384)
 extern int __signgam;
 
 long double lgammal(long double x)
@@ -351,4 +358,3 @@ long double lgammal(long double x)
 }
 
 weak_alias(__lgammal_r, lgammal_r);
-#endif
index c7aacf9..63dcc28 100644 (file)
@@ -182,4 +182,10 @@ done:
        z += e * (L102A);
        return z;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double log10l(long double x)
+{
+       return log10(x);
+}
 #endif
index 37da46d..141b5f0 100644 (file)
@@ -168,4 +168,10 @@ long double log1pl(long double xm1)
        z = z + e * C1;
        return z;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double log1pl(long double x)
+{
+       return log1p(x);
+}
 #endif
index d00531d..722b451 100644 (file)
@@ -173,4 +173,10 @@ done:
        z += e;
        return z;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double log2l(long double x)
+{
+       return log2(x);
+}
 #endif
index 03c5188..5d53659 100644 (file)
@@ -166,4 +166,10 @@ long double logl(long double x)
        z = z + e * C1; /* This sum has an error of 1/2 lsb. */
        return z;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double logl(long double x)
+{
+       return log(x);
+}
 #endif
index ce6274c..a765706 100644 (file)
@@ -513,5 +513,10 @@ static long double powil(long double x, int nn)
                y = 1.0/y;
        return y;
 }
-
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double powl(long double x, long double y)
+{
+       return pow(x, y);
+}
 #endif
index 4864ddf..b305d4d 100644 (file)
@@ -34,4 +34,10 @@ long double sinhl(long double x)
        t = expl(0.5*absx);
        return h*t*t;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double sinhl(long double x)
+{
+       return sinh(x);
+}
 #endif
index f594b85..4e1aa9f 100644 (file)
@@ -39,4 +39,10 @@ long double tanhl(long double x)
        }
        return sign ? -t : t;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double tanhl(long double x)
+{
+       return tanh(x);
+}
 #endif
index 5c1a02a..5336c5b 100644 (file)
@@ -272,4 +272,10 @@ small:
                q = z / (x * __polevll(x, S, 8));
        return q;
 }
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
+// TODO: broken implementation to make things compile
+long double tgammal(long double x)
+{
+       return tgamma(x);
+}
 #endif