Index: lib/msun/tests/logarithm_test.c =================================================================== --- lib/msun/tests/logarithm_test.c +++ lib/msun/tests/logarithm_test.c @@ -212,6 +212,17 @@ }; unsigned i; + long double log1p_ldbl_ulp = LDBL_ULP(); +#if LDBL_MANT_DIG > 64 + /* + * On ld128 platforms the log1p() implementation provides less accuracy, + * but does still match the ld80 precision. Use the ld80 LDBL_ULP() + * value for now. + * Reported as https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253984 + */ + log1p_ldbl_ulp = ldexpl(1.0, 1 - 64); +#endif + for (i = 0; i < nitems(tests); i++) { test_tol(log2, tests[i].x, tests[i].log2x, DBL_ULP()); test_tol(log2f, tests[i].x, tests[i].log2x, FLT_ULP()); @@ -228,7 +239,7 @@ test_tol(log1pf, tests[i].x - 1, tests[i].logex, FLT_ULP()); test_tol(log1pl, tests[i].x - 1, tests[i].logex, - LDBL_ULP()); + log1p_ldbl_ulp); } } } @@ -236,19 +247,30 @@ ATF_TC_WITHOUT_HEAD(log1p_accuracy_tests); ATF_TC_BODY(log1p_accuracy_tests, tc) { + long double ldbl_ulp = LDBL_ULP(); +#if LDBL_MANT_DIG > 64 + /* + * On ld128 platforms the log1p() implementation provides less accuracy, + * but does still match the ld80 precision. Use the ld80 LDBL_ULP() + * value for now. + * Reported as https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253984 + */ + ldbl_ulp = ldexpl(1.0, 1 - 64); +#endif + test_tol(log1pf, 0x0.333333p0F, 1.82321546859847114303367992804596800640e-1L, FLT_ULP()); test_tol(log1p, 0x0.3333333333333p0, 1.82321556793954589204283870982629267635e-1L, DBL_ULP()); test_tol(log1pl, 0x0.33333333333333332p0L, - 1.82321556793954626202683007050468762914e-1L, LDBL_ULP()); + 1.82321556793954626202683007050468762914e-1L, ldbl_ulp); test_tol(log1pf, -0x0.333333p0F, -2.23143536413048672940940199918017467652e-1L, FLT_ULP()); test_tol(log1p, -0x0.3333333333333p0, -2.23143551314209700255143859052009022937e-1L, DBL_ULP()); test_tol(log1pl, -0x0.33333333333333332p0L, - -2.23143551314209755752742563153765697950e-1L, LDBL_ULP()); + -2.23143551314209755752742563153765697950e-1L, ldbl_ulp); } ATF_TP_ADD_TCS(tp)