diff options
author | Szabolcs Nagy <nsz@port70.net> | 2015-03-10 20:01:20 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015-03-11 18:54:53 -0400 |
commit | f4e4632abfa8297db1485e132bb15b9ef6c32a1b (patch) | |
tree | 5e7f8685339372ad2eefa685cfa8e9c967300562 | |
parent | 53cfe0c61a136c12376a8f32d616de1d68227181 (diff) | |
download | musl-f4e4632abfa8297db1485e132bb15b9ef6c32a1b.tar.gz musl-f4e4632abfa8297db1485e132bb15b9ef6c32a1b.tar.bz2 musl-f4e4632abfa8297db1485e132bb15b9ef6c32a1b.tar.xz musl-f4e4632abfa8297db1485e132bb15b9ef6c32a1b.zip |
math: add dummy implementations of 128 bit long double functions
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.
-rw-r--r-- | src/internal/libm.h | 14 | ||||
-rw-r--r-- | src/math/acoshl.c | 6 | ||||
-rw-r--r-- | src/math/asinhl.c | 6 | ||||
-rw-r--r-- | src/math/atanhl.c | 2 | ||||
-rw-r--r-- | src/math/coshl.c | 6 | ||||
-rw-r--r-- | src/math/erfl.c | 10 | ||||
-rw-r--r-- | src/math/expl.c | 6 | ||||
-rw-r--r-- | src/math/expm1l.c | 6 | ||||
-rw-r--r-- | src/math/lgammal.c | 10 | ||||
-rw-r--r-- | src/math/log10l.c | 6 | ||||
-rw-r--r-- | src/math/log1pl.c | 6 | ||||
-rw-r--r-- | src/math/log2l.c | 6 | ||||
-rw-r--r-- | src/math/logl.c | 6 | ||||
-rw-r--r-- | src/math/powl.c | 7 | ||||
-rw-r--r-- | src/math/sinhl.c | 6 | ||||
-rw-r--r-- | src/math/tanhl.c | 6 | ||||
-rw-r--r-- | src/math/tgammal.c | 6 |
17 files changed, 111 insertions, 4 deletions
diff --git a/src/internal/libm.h b/src/internal/libm.h index 88a7eb47..df864111 100644 --- a/src/internal/libm.h +++ b/src/internal/libm.h @@ -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 diff --git a/src/math/acoshl.c b/src/math/acoshl.c index 4aa84acb..8d4b43f6 100644 --- a/src/math/acoshl.c +++ b/src/math/acoshl.c @@ -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 diff --git a/src/math/asinhl.c b/src/math/asinhl.c index e5f31751..8635f52e 100644 --- a/src/math/asinhl.c +++ b/src/math/asinhl.c @@ -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 diff --git a/src/math/atanhl.c b/src/math/atanhl.c index f63d60b1..87cd1cdb 100644 --- a/src/math/atanhl.c +++ b/src/math/atanhl.c @@ -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) { diff --git a/src/math/coshl.c b/src/math/coshl.c index 080e5eb0..06a56fe3 100644 --- a/src/math/coshl.c +++ b/src/math/coshl.c @@ -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 diff --git a/src/math/erfl.c b/src/math/erfl.c index 96b74dee..e267c231 100644 --- a/src/math/erfl.c +++ b/src/math/erfl.c @@ -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 diff --git a/src/math/expl.c b/src/math/expl.c index b62980fa..0a7f44f6 100644 --- a/src/math/expl.c +++ b/src/math/expl.c @@ -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 diff --git a/src/math/expm1l.c b/src/math/expm1l.c index 21a86c00..d1715078 100644 --- a/src/math/expm1l.c +++ b/src/math/expm1l.c @@ -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 diff --git a/src/math/lgammal.c b/src/math/lgammal.c index 55ec5325..2b354a7c 100644 --- a/src/math/lgammal.c +++ b/src/math/lgammal.c @@ -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 diff --git a/src/math/log10l.c b/src/math/log10l.c index c7aacf90..63dcc286 100644 --- a/src/math/log10l.c +++ b/src/math/log10l.c @@ -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 diff --git a/src/math/log1pl.c b/src/math/log1pl.c index 37da46d2..141b5f0b 100644 --- a/src/math/log1pl.c +++ b/src/math/log1pl.c @@ -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 diff --git a/src/math/log2l.c b/src/math/log2l.c index d00531d5..722b451a 100644 --- a/src/math/log2l.c +++ b/src/math/log2l.c @@ -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 diff --git a/src/math/logl.c b/src/math/logl.c index 03c5188f..5d536592 100644 --- a/src/math/logl.c +++ b/src/math/logl.c @@ -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 diff --git a/src/math/powl.c b/src/math/powl.c index ce6274cf..a765706d 100644 --- a/src/math/powl.c +++ b/src/math/powl.c @@ -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 diff --git a/src/math/sinhl.c b/src/math/sinhl.c index 4864ddfa..b305d4d2 100644 --- a/src/math/sinhl.c +++ b/src/math/sinhl.c @@ -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 diff --git a/src/math/tanhl.c b/src/math/tanhl.c index f594b85f..4e1aa9f8 100644 --- a/src/math/tanhl.c +++ b/src/math/tanhl.c @@ -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 diff --git a/src/math/tgammal.c b/src/math/tgammal.c index 5c1a02a6..5336c5b1 100644 --- a/src/math/tgammal.c +++ b/src/math/tgammal.c @@ -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 |