summaryrefslogtreecommitdiffstats
path: root/lib/msun/src/e_atan2l.c
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2008-08-02 03:56:22 +0000
committerdas <das@FreeBSD.org>2008-08-02 03:56:22 +0000
commitaffd78d50ba8b1771f24880fb9c08b8cb7efdaff (patch)
tree09a0f186a369e6bacb1337c3a309656715a70f93 /lib/msun/src/e_atan2l.c
parenta59aadb8d676bfb26dd7f5f8f11db083f37ad18d (diff)
downloadFreeBSD-src-affd78d50ba8b1771f24880fb9c08b8cb7efdaff.zip
FreeBSD-src-affd78d50ba8b1771f24880fb9c08b8cb7efdaff.tar.gz
On i386, gcc truncates long double constants to double precision
at compile time regardless of the dynamic precision, and there's no way to disable this misfeature at compile time. Hence, it's impossible to generate the appropriate tables of constants for the long double inverse trig functions in a straightforward way on i386; this change hacks around the problem by encoding the underlying bits in the table. Note that these functions won't pass the regression test on i386, even with the FPU set to extended precision, because the regression test is similarly damaged by gcc. However, the tests all pass when compiled with a modified version of gcc. Reported by: bde
Diffstat (limited to 'lib/msun/src/e_atan2l.c')
-rw-r--r--lib/msun/src/e_atan2l.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/msun/src/e_atan2l.c b/lib/msun/src/e_atan2l.c
index 8368bbf..0071a7c 100644
--- a/lib/msun/src/e_atan2l.c
+++ b/lib/msun/src/e_atan2l.c
@@ -30,8 +30,18 @@ __FBSDID("$FreeBSD$");
static volatile long double
tiny = 1.0e-300;
static const long double
-zero = 0.0,
-pi = 3.14159265358979323846264338327950280e+00L;
+zero = 0.0;
+
+#ifdef __i386__
+/* XXX Work around the fact that gcc truncates long double constants on i386 */
+static volatile double
+pi1 = 3.14159265358979311600e+00, /* 0x1.921fb54442d18p+1 */
+pi2 = 1.22514845490862001043e-16; /* 0x1.1a80000000000p-53 */
+#define pi ((long double)pi1 + pi2)
+#else
+static const long double
+pi = 3.14159265358979323846264338327950280e+00L;
+#endif
long double
atan2l(long double y, long double x)
OpenPOWER on IntegriCloud