git: b8beded34398 - stable/13 - Allow lib/msun/logarithm_test to pass on ld128 platforms

Alex Richardson arichardson at FreeBSD.org
Thu Apr 22 11:08:42 UTC 2021


The branch stable/13 has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=b8beded343980477e6d670c263fda7b0007510cc

commit b8beded343980477e6d670c263fda7b0007510cc
Author:     Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2021-04-19 23:22:45 +0000
Commit:     Alex Richardson <arichardson at FreeBSD.org>
CommitDate: 2021-04-22 09:44:55 +0000

    Allow lib/msun/logarithm_test to pass on ld128 platforms
    
    For some reason the ld128 log1pl() implementation is less accurate than
    logl(), but does at least guarantee precision >= the ld80 implementation.
    Mark log1p_accuracy_tests as XFAIL for ld128 and increase the log1p tolerance
    to the ld80 equivalent in accuracy_tests to avoid losing test coverage for
    the other functions.
    
    PR:             253984
    Reviewed By:    ngie, dim
    Differential Revision: https://reviews.freebsd.org/D29039
    
    (cherry picked from commit 1ad83445fc0f1d2aecd32635f4ae713a057aa091)
---
 lib/msun/tests/logarithm_test.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/lib/msun/tests/logarithm_test.c b/lib/msun/tests/logarithm_test.c
index 48a368765b71..e372e889cb82 100644
--- a/lib/msun/tests/logarithm_test.c
+++ b/lib/msun/tests/logarithm_test.c
@@ -212,6 +212,17 @@ ATF_TC_BODY(accuracy_tests, tc)
 	};
         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 to avoid losing test coverage for the other functions.
+	 * 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 @@ ATF_TC_BODY(accuracy_tests, tc)
 			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,6 +247,11 @@ ATF_TC_BODY(accuracy_tests, tc)
 ATF_TC_WITHOUT_HEAD(log1p_accuracy_tests);
 ATF_TC_BODY(log1p_accuracy_tests, tc)
 {
+#if LDBL_MANT_DIG > 64
+	if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
+		atf_tc_expect_fail("https://bugs.freebsd.org/253984");
+#endif
+
 	test_tol(log1pf, 0x0.333333p0F,
 		 1.82321546859847114303367992804596800640e-1L, FLT_ULP());
 	test_tol(log1p, 0x0.3333333333333p0,


More information about the dev-commits-src-all mailing list