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:
+#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
#else
#error Unsupported long double representation
#endif
return logl(2*x - 1/(x+sqrtl(x*x-1)));
return logl(x) + 0.693147180559945309417232121458176568L;
}
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);
+}
+#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);
+}
-#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)
{
/* 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)
{
t = expl(0.5*x);
return 0.5*t*t;
}
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);
+}
y = 0x1p-16382L;
return sign ? 2 - y : y*y;
}
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);
+}
x = 1.0 + 2.0 * x;
return scalbnl(x, k);
}
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);
+}
x = px * qx + (px - 1.0);
return 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);
+}
r = nadj - r;
return r;
}
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);
+}
-#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)
extern int __signgam;
long double lgammal(long double x)
}
weak_alias(__lgammal_r, lgammal_r);
}
weak_alias(__lgammal_r, lgammal_r);
z += e * (L102A);
return z;
}
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);
+}
z = z + e * C1;
return z;
}
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);
+}
+#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);
+}
z = z + e * C1; /* This sum has an error of 1/2 lsb. */
return z;
}
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);
+}
+#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);
+}
t = expl(0.5*absx);
return h*t*t;
}
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);
+}
}
return sign ? -t : t;
}
}
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);
+}
q = z / (x * __polevll(x, S, 8));
return q;
}
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);
+}