Bug 253984 - log1pl() is less accurate than logl() on LD128 platforms
Summary: log1pl() is less accurate than logl() on LD128 platforms
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Alex Richardson
URL:
Keywords:
Depends on:
Blocks: 290099
  Show dependency treegraph
 
Reported: 2021-03-03 16:26 UTC by Alex Richardson
Modified: 2026-06-26 17:00 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Richardson freebsd_committer freebsd_triage 2021-03-03 16:26:32 UTC
This causes failures in the logarithm_test on non-x86 platforms such as AArch64:

*** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/logarithm_test.c:255: (log1pl)(_d) (0.1823215567939546262083299) ~= (1.82321556793954626202683007050468762914e-1L) (0.182321556793954626202683), diff=5.6468863150286609024e-21, maxdiff=3.5113854573677529636e-35,
*** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/logarithm_test.c:262: (log1pl)(_d) (-0.2231435513142097557612129) ~= (-2.23143551314209755752742563153765697950e-1L) (-0.2231435513142097557527426), diff=8.4703294725430033907e-21, maxdiff=4.2975884737294630475e-35,
Comment 1 commit-hook freebsd_committer freebsd_triage 2021-04-20 00:47:39 UTC
A commit in branch main references this bug:

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

commit 1ad83445fc0f1d2aecd32635f4ae713a057aa091
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-04-19 23:22:45 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2021-04-20 00:46:43 +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

 lib/msun/tests/logarithm_test.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2021-04-22 11:09:42 UTC
A commit in branch stable/13 references this bug:

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

commit b8beded343980477e6d670c263fda7b0007510cc
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-04-19 23:22:45 +0000
Commit:     Alex Richardson <arichardson@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(-)
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2024-11-25 04:05:09 UTC
^Triage: committed and MFCed back in 2021.
Comment 4 Siva Mahadevan freebsd_committer freebsd_triage 2025-12-16 19:03:32 UTC
I'm not sure that there is an actual fix for this discrepancy because the test has only been xfailed. @arichardson can you confirm the status of this? Should this bug be closed as fixed?
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-06-17 17:09:42 UTC
A commit in branch main references this bug:

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

commit 19af9c77acc912e4bf90a667924f5f4ff78a7759
Author:     Siva Mahadevan <siva@FreeBSD.org>
AuthorDate: 2026-06-17 17:04:54 +0000
Commit:     Siva Mahadevan <siva@FreeBSD.org>
CommitDate: 2026-06-17 17:04:54 +0000

    msun/logarithm_test: expect_fail log1p_accuracy_tests in the correct spot

    While here, remove the conditional on the "ci" config var to ensure that
    this is reproducible locally as well.

    This fixes a case where we are expecting a fail before the failing ATF_CHECK_*
    assertion happens. Found in a CI failure here:
    https://ci.freebsd.org/job/FreeBSD-main-riscv64-test/16608/testReport/lib.msun/logarithm_test/log1p_accuracy_tests/

    PR:             253984
    Fixes:          405188aeac540f7666dfde37c2f32d222119f56e
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D57351

 lib/msun/tests/logarithm_test.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2026-06-26 15:19:24 UTC
A commit in branch stable/15 references this bug:

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

commit c5be733527f1e4fabc83e35c87e26afd002e08e2
Author:     Siva Mahadevan <siva@FreeBSD.org>
AuthorDate: 2026-06-17 17:04:54 +0000
Commit:     Siva Mahadevan <siva@FreeBSD.org>
CommitDate: 2026-06-26 15:16:44 +0000

    msun/logarithm_test: expect_fail log1p_accuracy_tests in the correct spot

    While here, remove the conditional on the "ci" config var to ensure that
    this is reproducible locally as well.

    This fixes a case where we are expecting a fail before the failing ATF_CHECK_*
    assertion happens. Found in a CI failure here:
    https://ci.freebsd.org/job/FreeBSD-main-riscv64-test/16608/testReport/lib.msun/logarithm_test/log1p_accuracy_tests/

    PR:             253984
    Fixes:          405188aeac540f7666dfde37c2f32d222119f56e
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D57351

    (cherry picked from commit 19af9c77acc912e4bf90a667924f5f4ff78a7759)

 lib/msun/tests/logarithm_test.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2026-06-26 17:00:44 UTC
A commit in branch stable/14 references this bug:

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

commit 487e1d061615935c91c0ec71c7be3e6fb60cdeb1
Author:     Siva Mahadevan <siva@FreeBSD.org>
AuthorDate: 2026-06-17 17:04:54 +0000
Commit:     Siva Mahadevan <siva@FreeBSD.org>
CommitDate: 2026-06-26 16:10:59 +0000

    msun/logarithm_test: expect_fail log1p_accuracy_tests in the correct spot

    While here, remove the conditional on the "ci" config var to ensure that
    this is reproducible locally as well.

    This fixes a case where we are expecting a fail before the failing ATF_CHECK_*
    assertion happens. Found in a CI failure here:
    https://ci.freebsd.org/job/FreeBSD-main-riscv64-test/16608/testReport/lib.msun/logarithm_test/log1p_accuracy_tests/

    PR:             253984
    Fixes:          405188aeac540f7666dfde37c2f32d222119f56e
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D57351

    (cherry picked from commit 19af9c77acc912e4bf90a667924f5f4ff78a7759)

 lib/msun/tests/logarithm_test.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)