From 1d9ab20c14211abbf45514e63c190dfeec27fa5e Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 26 Feb 2015 21:06:34 +0000 Subject: Fix ldbl-128/ldbl-128ibm acosl inaccuracy (bug 18038, bug 18039). The ldbl-128 and ldbl-128ibm implementations of acosl have similar bugs, using a threshold of 0x1p-57L to determine when they just return pi/2. Since the result pi/2 - asinl (x) is roughly pi/2 - x for small x, the relevant cut-off is actually x being < 0.5ulp of 1. This patch fixes the implementations to use that cut-off and adds tests of small acos arguments. Tested for powerpc and mips64. Also tested for x86_64 and x86; no ulps updates needed. [BZ #18038] [BZ #18039] * sysdeps/ieee754/ldbl-128/e_acosl.c (__ieee754_acosl): Only return pi/2 for arguments below 0x1p-113L. * sysdeps/ieee754/ldbl-128ibm/e_acosl.c (__ieee754_acosl): Only return pi/2 for arguments below 0x1p-106L. * math/auto-libm-test-in: Add more tests of acos. * math/auto-libm-test-out: Regenerated. --- sysdeps/ieee754/ldbl-128ibm/e_acosl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdeps/ieee754/ldbl-128ibm') diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c index 2cb288238b..e5030f1b52 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c @@ -169,7 +169,7 @@ __ieee754_acosl (long double x) } if (a < 0.5L) { - if (a < 6.938893903907228e-18L) /* |x| < 2**-57 */ + if (a < 0x1p-106L) return pio2_hi + pio2_lo; if (a < 0.4375L) { -- cgit 1.4.1