Repository navigation
fix(libc): compute asinf with FreeBSD msun's algorithm, as titles' libc.prx does - #9771
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
The asinf implementation follows the cited FreeBSD msun three-range algorithm, and the reported exhaustive comparison against two console libc builds is strong evidence. I compiled a temporary harness from the exact AsinfRational/asinf_nid_postfix source in this head and ran the 13 added bit-pattern cases; all passed and a preset errno remained unchanged. This was not the full guest_math target. Current-main merge-tree, diff-check and conventions are clean, and the intervening main commits do not touch the changed Math.cpp, GuestMath.cpp or debt paths. Hosted product Linux/Windows tests are skipped; the register-context CI job is a separate suite.
Please resolve the repository's required overlap coordination before merge. Pairwise merges of this head with open #9643 conflict in Math.cpp at the adjacent fmodf/asinf hunk, and with #9668 in the adjacent libc debt entries. Both pairs compose by retaining both changes, but CONTRIBUTING.md requires the authors to agree an order and record any needed Depends on entry. I asked each author to confirm whether either order works. Please record the agreements on this PR and update the checklist if one must land first. I found no duplicate asinf implementation.
|
@MarcZX10 thanks. On order: either works from my side, and
If either of you merges first, I'll rebase this onto it with that resolution and rerun |
|
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.
|
|
@Noxy-HNR @rooklz — following the overlap review, either landing order is acceptable from #9771's side. I checked heads Neither is a functional prerequisite for this change. If either lands first, I will refresh #9771, retain both changes and rerun |
|
Back to draft: @MarcZX10 clarified that the #5239 intake guidance is still active (#9688 (comment)). While the open queue is above 700, a PR should name a title shown to need the change on current |
3cd4f5c to
9573ed1
Compare
There was a problem hiding this comment.
The author has now rebased #9771 onto 499b1cf9fc and reports three passing Windows guest_math/libc runs, including the exhaustive comparison against the two cited title libc.prx builds. The head has a clean merge tree with current main; conventions and diff-check pass. The earlier overlap note remains explicit: merge resolution must retain adjacent #9643 fmodf and this asinf implementation/tests, and keep both #9668 acosf and this debt entry. The author has offered either order but the other authors have not confirmed in the visible conversation, so please record their confirmation or coordinate before merging. The branch is eight commits behind current main; please refresh the stack and rerun guest_math on the new head. I withdraw the queue-based request to keep this in draft. It is fine to keep submitting PRs; maintainers will handle them in due course. The branch-freshness and overlap requests above remain separate.
|
@MarcZX10 thanks. Same as on #9784: none of the commits since 499b1cf touch |
|
I’ve noticed that asking you to hold this PR was unnecessary. It’s fine to keep submitting PRs; maintainers will handle them in due course. |
|
Heads-up from #9643, which also edits |
9573ed1 to
e4b95a9
Compare
|
I pushed 7d5caab: Why: the Tests, Windows, GCC 15.2 UCRT, Release:
AI-assisted: yes (Claude Code) |
|
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). |
…bc.prx does asinf returned the host asin, so its last bit depended on the host: on Windows it differs from the libc.prx that titles ship on 5,413,834 of the floats in (-1, 1). That libc.prx is msun's e_asinf.c, which gives the same bits as PPSA07923's and PPSA05916's copies for all 2^32 arguments. errno is still left unchanged for |x| > 1 and NaN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
asinf left errno unchanged for |x| > 1, the infinities and NaN, following included, stores EDOM there and leaves it alone for |x| <= 1; asinf now does the same, and the test expects it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7d5caab to
6d9fd5d
Compare
What
asinfreturned the host'sasin, so its last bit depended on the host. On Windows (UCRT) it differs from thelibc.prxthat titles ship on 5,413,834 of the floats in (-1, 1). Examples, console thenmain:0x3b3a82da→0x3b3a82ea,maingives0x3b3a82eb;0x3f0008fb→0x3f0614f1,maingives0x3f0614f0.The titles'
asinf(NIDGZWjF-YIFFk) is FreeBSD msun'se_asinf.c.asinfnow computes it the same way:pS0..pS2/qS1(AsinfRational);0.5 <= |x| < 1,sqrtand the final step in double, as msun has them.The build targets baseline x86-64, so nothing is contracted into FMA.
errno: for|x| > 1, the infinities and NaN this storesEDOMbefore returning(x - x) / (x - x), as thelibc.prxbundled with eleven titles does, PPSA13934's included. That reverses #3693'serrno == 0expectation inCheckAsinfErrno, which now checksEDOMfor ±2, ±infand a NaN, and an untouchederrnofor ±1, 0.5 and 0 (cc @CouchRiv). Tiny arguments returnxwithout raisingFE_INEXACT.asinfis imported by 21 of the 22 titles whose relinker registries I audited, for example PPSA01528, PPSA02630, PPSA04158 and PPSA09614. This is theasinfcounterpart of #9668 (acosf).Tested
Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release,
BUILD_TESTING=ON,main8b3e398.libc.prxof PPSA07923 and PPSA05916 natively and supplies__error. Theirasinfand this build'sasinf_nid_postfixgive the same bits for all 2^32 arguments, NaN payloads included. This build storesEDOMexactly where they do: for those eleven titles,asinfstoresEDOMfor ±2,infand a quiet NaN and leaveserrnoalone for 1 and 0.5, and the-O3libc.prxDLL of this branch matches PPSA07923'sasinfbits anderrnoon 400,012 sampled inputs.acosfin fix(libc): compute acosf with FreeBSD msun's algorithm, as the console's libc.prx does #9668).guest_math: the newCheckAsinfConsoleBitshas 13 cases with the console's outputs: both ranges, ±1, the last float below 1, tiny, -0, the smallest subnormal,2.0and a NaN payload.guest_mathand the libc tests (8) pass in three runs out of three. Withmain'sMath.cppand this test,guest_mathaborts in aRequire.python tools/check_conventions.py --base origin/mainandgit diff --checkpass.tools/pr_overlap.py --branch: adjacency conflicts only. fix(libc): preserve errno across fmodf domain errors #9643 rewritesfmodf, the line aboveasinf; fix(libc): compute acosf with FreeBSD msun's algorithm, as the console's libc.prx does #9668 adds itsacosfdebt entry near this one. Keeping both sides resolves each.e4b95a92dmerged cleanly ontomainfcd455870: Ubuntu 26.04 in Docker on Windows, GCC 15, glibc 2.43, WSL2 kernel 6.6, Release,BUILD_TESTING=ON. The reviewer reports five passingguest_mathruns (--repeat until-fail:5). Keeping this PR's test while restoring main's changed production sources makes the test fail on Linux as well. This supplies a Linux regression comparison in addition to the Windows evidence above; it is reviewer-supplied evidence for those revisions, not a local rerun or a latest-main claim.Overlap coordination
#9643 changes the adjacent
fmodfwrapper; #9668 adds the adjacentacosfdebt entry. From this PR's side either landing order is acceptable: retain both functions, both test additions and both debt entries, then rerunguest_mathafter resolving any adjacency conflict. No functional dependency is proposed. Both authors have confirmed either order: @Noxy-HNR for #9643 and @rooklz for #9668. Whichever lands second retains both implementations and test additions, plus both debt entries (acosfthenasinf), and reruns the focused math tests.Depends onremains none.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)sinhfentry didAI-assisted (Claude Code).