Repository navigation
fix(libc): quiet signalling NaNs in trunc, ceil, floor and nearbyint as titles' libc.prx does - #10370
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed current head 58833d2. The eight wrappers now quiet NaNs by evaluating x + x only for NaN inputs and leave finite/infinite paths unchanged. The added bit-pattern vectors cover positive/negative signalling NaNs, payload/sign preservation, quiet NaNs and infinities across all eight functions. The author reports exact-head guest_math and guest_dinkumware_internals passing three times and comparison against bundled libc.prx copies; hosted eligibility, conventions, intake, labels and report checks pass. Product Linux/Windows checks are skipped by policy; relinker and memory checks were still running when reviewed. I did not run guest_math locally. git diff --check upstream/main...upstream/pr/10370 passes. No blocking issue found.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Linux run at this PR's exact head Arch Linux, kernel 7.2.9, Ryzen 9 7950X, g++ (GCC) 16.2.1 20260810, glibc 2.44, x86-64. Release,
This is the focused test only; no title, console or floating-point exception flags were checked. AI-assisted: yes (Claude Code). |
Additive conflicts with main's newer libc changes: the debt list keeps both sides' entries (per entry) and GuestMath.cpp keeps both sides' test functions and calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged current
AI-assisted: yes (Claude Code) |
e2a9217 to
2641b6f
Compare
|
Refreshed as one commit Fresh Linux libc/math build passes, guest_math and guest_dinkumware_internals each pass three runs, and the production-only main control aborts guest_math. Restoration reproduces the original library bytes and passing tests. Conventions/whitespace pass; merge-tree against fetched main Exact-head validation/rebase/control receipts, SHA-256 |
…as titles' libc.prx does trunc, ceil, floor and nearbyint and their float forms returned the host's result, which on Windows passes a signalling NaN through unchanged. The titles' copies follow FreeBSD msun, which returns x + x for a NaN, so the NaN comes back quieted with its payload and sign; these functions now do the same before calling the host for other arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a990a75 to
f91f045
Compare
What
trunc,ceil,floorandnearbyint, and their float forms, returned the host's result. On Windows (UCRT) that passes a signalling NaN through unchanged. Thelibc.prxthat titles ship follows FreeBSD msun (s_trunc.c,s_floor.cand the others), which returnsx + xfor a NaN. So the NaN comes back quieted, with its payload and sign. For example,floor(0x7ff0000000000001)is0x7ff8000000000001there and0x7ff0000000000001here, andfloorf(0xffa00123)is0xffe00123there.Each of the eight functions now returns
x + xfor a NaN argument and calls the host otherwise. Every other result already matched the titles' copies, including infinities, zeros and quiet NaNs.Tested
Current Linux validation:
2641b6fe919881a71c0a850252ecddf1e59ca59bis one commit on main52a8bed576e5c54a7f443728cdf663a080f8f9ed, without the old merge commit. Original production added/removed lines are unchanged; current main's expm1 fixtures and this topic's NaN fixtures/calls are both retained, with obsolete manual declarations left removed in favor of the API headers.Linux x86-64 / GCC 16.2.1 / Release: independent libc/math build and guest_math plus guest_dinkumware_internals each pass three runs. With only production Math.cpp replaced by this tested main and the NaN cases retained, guest_math aborts. Restoring the change gives six passing invocations and the original libc library SHA-256
2b21e99d369eb2bea7f9fdddb508cdab905bf69a56c49a14e6baf97abd1c9573. No named assertion is emitted by the Release negative control. Conventions and whitespace pass. The first build process was terminated after successful configuration; its incomplete receipt is preserved/excluded, and the resumed build completed successfully before all tests.Read-only merge-tree against fetched main
25c1aa1e79329e0e2957b4fdd731144dad8be724is clean; that merge tree was not rebuilt. Exact-head Linux logs/JUnit, rebase proof and negative/restoration controls, SHA-2566c0a1a6c064a35cb55d5e985686657faee26e925c92ff1c38fc2e8a2d480c3cd. Windows remains user-paused and was not rerun on this head.Historical original Windows/bundled-module evidence (not rerun on the current head):
Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release,
BUILD_TESTING=ON,maind7948b0.libc.prxof eleven titles natively and supplies__error: PPSA04158, PPSA05916, PPSA07923, PPSA09614, PPSA13934, PPSA20423, PPSA25636, PPSA26528, PPSA33655, PPSA34008 and PPSA35169.errno.main's-O3libc.prxDLL next to PPSA07923's copy, the eight functions differ on 48 (double) and 390 (float) of 400,012 sampled inputs each, all signalling NaNs.-O3libc.prxDLL matches the copies bundled with PPSA07923 and PPSA13934 on all 400,012 inputs of each of the eight functions.guest_math: the newCheckRoundingNaNConsoleBitschecks those five inputs against the bundled-module results for all eight functions.main's existing rounding checks still pass.guest_mathandguest_dinkumware_internalspass in three runs out of three on the exact head.main'sMath.cppand these tests,guest_mathaborts in aRequire, whileguest_dinkumware_internalsstill passes.python tools/check_conventions.py --base origin/mainandgit diff --checkpass.52a8bed576e5c54a7f443728cdf663a080f8f9ed; retains current main’s expm1 tests alongside this topic’s signalling-NaN cases.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)AI-assisted (Claude Code).