Repository navigation
fix(libc): compute atanh with FreeBSD msun's algorithm, as titles' libc.prx does - #10315
Conversation
|
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). |
b347b50 to
7b11c44
Compare
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) |
|
Opened #10565 as a separate atanh pole/domain exception-state follow-up on exact parent e46b225. The parent matches result bits and errno, but the two bundled copies also raise the matching x87 exception; quiet NaNs take invalid in both banks. Two existing _Feraise calls preserve the parent’s returns and errno while matching those effects. Same-test control fails by name; candidate math/exact/Dinkumware pass 3/3. Fresh actual control/change and FAR/Tetris bundled copies: 1,112 inputs × 48 environments = 53,376 calls per arm. Control has 12,608 exception-state mismatches; candidate has zero differences in every checked field, with no result-bit or errno changes. Full evidence/limits are in #10565. No change to this parent’s head or evidence, no Windows/physical-console/FPS claim. #10314 remains the transitive log1p dependency; the other log1p follow-ups are separate. |
|
Merged current
AI-assisted: yes (Claude Code) |
Math.cpp: keep this branch's msun atanh and main's msun acoshf, each defined once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
harisibrar1
left a comment
There was a problem hiding this comment.
Checked against main 39a36bb and FreeBSD release/11.4.0 lib/msun/src/e_atanh.c (over s_log1p.c):
- The port matches e_atanh.c: the
(ix|((lx|-lx)>>31))domain test, thex/zeropole, the 2^-28 shortcut and both log1p forms.EDOMandERANGEare added only at msun's two error returns. - I wrote my own Python port of e_atanh.c over s_log1p.c (plain doubles), and it reproduces all 24
CheckAtanhConsoleBitsexpectations, including NaN payloads and errno. - Merge order with #10314: this branch carries the pre-rebase log1p commit 0c8ca62, not #10314's current head f4cb186, so git does not recognise it as the same change. I simulated main, then #10314, then this PR with
git merge-file; the reverse order gives the same result.- All three files merge without conflict markers.
Math.cppends up with a singlelog1p. GuestMath.cppgets twostatic void CheckLog1pConsoleBits()definitions, because this PR inserts it afterMakeExtendedand #10314 afterCheckExpm1ConsoleBits.main()also gets two calls to it. That would fail to compile as a redefinition. I didn't build it.docs/dev/debt/libc.mdgets two identicallog1pbullets, one beforeexpm1and one after.- Could you rebase onto #10314 once it lands, dropping 0c8ca62? Until then, could you put the log1p test and debt entry exactly where #10314 has them?
- All three files merge without conflict markers.
- Otherwise this still merges cleanly onto current main, and main's
atanhis still the host forwarder.
Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
|
@JJenkx I checked 1cc9d1a and the intervening merge. Both atanh and main’s acoshf are preserved, with the Atanh, Expm1 and Acoshf checks intact and called once. My source verdict carries. Thanks for keeping the new Linux results separate from the older Windows evidence and for separating #10565. This still follows #10314 and needs final-head/full-composition CI, including Windows and Dinkumware coverage. |
|
Aligned the inherited log1p definition, call and debt entry exactly with #10314 in |
|
Windows run of c974e4e merged onto Built |
MarcZX10
left a comment
There was a problem hiding this comment.
The earlier review identified a real stacked-test collision with #10314; the updated description says the inherited log1p test and debt entry now align with that branch, which addresses that concern. The integration evidence is still based on 6c52b64, 6,822 commits behind current main, and the hosted Linux/Windows product jobs are skipped. Please refresh #10314 and this dependent branch onto current main, then rerun guest_math and guest_dinkumware_internals on the final head on Linux and Windows. Keep the negative control tied to that final tree.
c974e4e to
916ef2d
Compare
|
Refreshed to current main Fresh Linux libc/math builds pass. Exact pins, patches, stack proof, logs/JUnit and negative/restoration; SHA-256 Fresh Windows coverage remains requested; our Windows machine is user-paused. Earlier independent Windows reports remain tied to their original integration pins. Original-module matrices were not rerun. Description updated with these limits. Hosted update: both macOS relinker architectures passed in run40144377353. The remaining red job is write-watch macOS Intel, which failed while fetching refs ( |
|
Additional Linux integration check: refreshed #10314/#10315 with exact #10468 head Private combined head Conflict-resolution receipts, combined patch, exact pins, build/test logs and JUnit, SHA-256 |
916ef2d to
cb1a8b2
Compare
|
Windows exact-head qualification of Setup:
Negative attribution: the test's
Binary identity of positive and restored:
Scope:
@MarcZX10 with the Linux results above and these Windows results, both requested exact-head runs and the narrow negative control are in. Could you re-review? AI-assisted: yes (Claude Code). |
|
@MarcZX10 Refreshed against main Only additive conflicts needed resolution: the atanh calls/debt entry and main's log10/log2 calls/debt entries are all retained. The atanh body is byte-identical to reviewed public head Fresh Linux x86-64 Release: Current-merge logs, JUnit, control backtrace, hashes and exact diff, SHA-256 AI-assisted: yes. |
|
Current-head Windows qualification is complete at Supported-behavior negative: replacing only Frozen source proofs, bounded harness, raw logs/JUnit, hashes and terminal FIFO receipts, SHA-256 This is focused Windows HLE CPU qualification. Earlier reference measurements retain their original pins; no new bundled-library reference, console, title/GPU, performance or full-suite result. AI-assisted: yes (Sol6.1medium). @MarcZX10, please re-review this exact head and trigger upstream full CI with the requested current-head Windows and negative-control evidence now attached. |
atanh carries over FreeBSD msun's lib/msun/src/e_atanh.c at release/11.4.0. Name that source above atanh_nid_postfix, in the form the exp port uses, followed by the file's Sun copyright and permission notice copied verbatim (its trailing space included, as main keeps it for the other SunSoft notices). No code changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Added the source note and licence notice this port was missing ( AI-assisted: yes. |
|
Current-main integration — 2026-11-03. Head Linux x86-64 Release, GCC 16.2.1, Ninja, BUILD_TESTING=ON: rebuilt actual libc and math executables. Source/parent/gitlink proofs, exact library/test hashes, raw logs/JUnit, and head-leased push receipts: qualification archive, SHA-256 |
|
Fresh final-head Windows follow-up to review5640048774, at exact public Rebuilt libc and the three math/Dinkumware executables. The supported-behavior negative changes only Raw original/negative/restored PE hashes are retained. Original/restored raw hashes differ in PE metadata; a separate in-memory comparison zeroes ONLY the COFF timestamp and PE checksum and proves all remaining bytes identical. Production binaries are not normalized or patched, and all frozen executable/source hashes are restored. Exact source/provider/module proofs, raw logs/JUnit, narrow negative patch, PE comparison and terminal FIFO cleanup, SHA-256 This closes the fresh Windows portion only. The separate Linux refresh/negative evidence keeps its own pins and scope; no fresh Linux negative, SDK-module reference, macOS, console, title/GPU, performance or full-suite result is claimed here. AI-assisted: yes (Sol6.1medium). @MarcZX10, please re-review this exact-head Windows positive/negative/restoration evidence; upstream full CI remains separate. |
|
Fresh Linux negative/restoration qualification for final head Verified Linux logs, JUnit, control patch, source/provider fingerprints and restoration proof — SHA-256 @MarcZX10 This supplies the final-tree Linux negative requested in review 5640048774; the older controls remain attributed to their original pins. Please re-review the refreshed head and current checks when available. AI-assisted: yes (Codex). |
|
Windows check for the scheduled cross-platform review, at head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run this test on pull requests.
AI-assisted: yes. |
✅ AMD GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (14, not counted against this PR)Validation IDs already present on main (4 IDs in 807 tests)Skipped (61)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
Met: the branch was refreshed onto current main (head 9811e07) and guest_math + guest_dinkumware_internals were rerun on the final head on Linux and Windows, as asked. Dismissing as met.
# Conflicts: # core/libs/tests/GuestMath.cpp # docs/dev/debt/libc.md
|
Refreshed onto Resolution: I kept
The merge differs from Windows, WinLibs GCC 15.2 UCRT, Release:
AI-assisted: yes. |
|
Linux check of exact head
AI-assisted: yes |
What
atanhreturned the host'satanh, so its last bit and itserrnodepended on the host. For example,atanh(0x3f03a67d5567227b)is0x3f03a67d558ea76ein the bundledlibc.prxand0x3f03a67d558ea76fon Windows (UCRT). On 20 million random arguments, UCRT'satanhdiffers from the titles' copy on 1,841,966.The titles' copy (NID
YjbpxXpi6Zk) is FreeBSD msun'se_atanh.c, computed through msun'slog1p.atanhnow computes it overlog1p_nid_postfix, the msun port supplied by the already merged #10314:2^-28shortcut;|x| < 0.5form0.5 * log1p(2x + 2x^2 / (1 - x));0.5 * log1p(2x / (1 - x))form above it.errno: msun sets none. The titles' copy sets it at msun's two error returns:EDOMat(x - x) / (x - x), for |x| > 1, the infinities and every NaN, keeping NaN payloads;ERANGEatx / 0, for ±1.This is the same rule as the bundled library's
atanhfalready in the debt file. The internallog1pcalls always get arguments ≥ 0, solog1p's ownEDOMnever fires from here.Tested
Current-main refresh — 2026-11-04. Head
9811e07c2f421d3ea034cb7f3388a006dc354c11merges main9ab6a281ea61c9e62a7eb07eb4cef8f19ede1c5cwhile retaining the prior public head as an ancestor. Main’s newer code, regression fixtures and debt entries are preserved alongside this topic.Linux x86-64, GCC16.2.1, Ninja Release: actual libc, libkernel and libSceAmpr CMake owners rebuilt coherently.
guest_math,guest_math_exact,guest_dinkumware_internalseach pass three consecutive runs (9 passes, zero skips). The same groups pass three times on pinned main. Public-header audit and conventions pass. Original licence-notice trailing whitespace is retained where present. The scoped recipe reuses frozen ZArchive/zstd providers; this is not a whole-project build. No new Windows, bundled-SDK, physical-console, title/GPU or FPS measurement is claimed; earlier reports retain their original pins.Exact source/parent proofs, per-branch patches/input manifests, build and CTest logs/JUnit, library/executable hashes and scoped CMake recipe, SHA-256
97a2377bc996be1690e8853e1ea090a98b5ed808bcc37a15a5cdada5c2e00845(download verified). AI-assisted: yes (Codex).Current-main integration — 2026-11-03. Head
7c767c439fb25a28415020465d9f727ecf964fe5includes main4f41f4c375f5abb487dbd184fbc150f31994d762and retains the prior public history and attribution/licence notices. Main’s newer math implementations and fixtures remain alongside this topic.Linux x86-64 Release, GCC 16.2.1, Ninja, BUILD_TESTING=ON: rebuilt actual libc and math executables.
guest_math,guest_math_exact, andguest_dinkumware_internalseach pass 3/3 (9 passes, zero skips);public_headersand conventions pass. The same three groups pass 3/3 plus headers on pinned main. All 34 recursive dependency trees and 31,551 tracked blobs verify with zero errors; the update=none QuickJS test262 corpus is excluded from these library inputs.git diff --checkreports the preserved verbatim licence trailing-space line; no other whitespace warnings occur.Source/parent/gitlink proofs, exact library/test hashes, raw logs/JUnit, and head-leased push receipts: qualification archive, SHA-256
e6a50522bc28e30871fdc2c12a88d2537515914239e8166f6237f48895126a06(download verified). That Linux archive makes no Windows/macOS, SDK-module, console, title/GPU or performance claim; older platform/reference reports retain their original pins. AI-assisted: yes (Codex). The prior Windows/negative-control head remains0a95fd8f78c6b9c57c5a16212b48b3b01cbe0b0b; relevant atanh/log1p routines, edge fixtures, Dinkumware source/test and VABI header are byte-identical, that continuity proof remains separately scoped. Fresh final-head Linux and Windows controls are recorded below.Fresh current-head Windows qualification — 2026-11-03: exact 7c767 Windows receipt records 12/12 initial math/exact/Dinkumware/header passes, a frozen-test body-only
std::atanhnegative atCheckAtanhConsoleBits, then 12/12 restored passes, zero skips. Actual module binding, 37,044 source/provider blobs and raw hashes are verified. Raw PE hashes differ; only timestamp/checksum fields are zeroed in a separate in-memory comparison, with all other bytes identical. This is not a fresh Linux negative or a new SDK-module/console/title/performance/full-suite result. AI-assisted: yes (Sol6.1medium).Fresh current-head Linux negative/restoration — 2026-11-03: On the same exact
7c767c439fb25a28415020465d9f727ecf964fe5head, the three math/exact/Dinkumware groups pass three times each (9). Replacing only the doubleatanh_nid_postfixbody withreturn std::atanh(x);fails the unchangedCheckAtanhConsoleBitsbit assertion atGuestMath.cpp:1417. Restoring the exact source returns all three groups to three passes each (9), pluspublic_headers, zero skips. The library and all three test executables have identical raw SHA-256s before and after restoration. Both 31,551-provider-blob audits match; source is clean and the actual privatelibc.prxloader path is recorded. Verified Linux control/restoration logs, JUnit and fingerprints, SHA-2564cf51299cc068b43477322860d635451ba2450a478ea6b865af3e85b18c0ca5c. This supplies a fresh Linux final-tree negative separately from the historical controls; no new SDK-module, console, title or performance comparison. AI-assisted: yes (Codex).Earlier dated qualifications below retain their recorded source/platform pins.
Historical head
0a95fd8f78c6b9c57c5a16212b48b3b01cbe0b0bmerged main92d2fdc3438f83e39d624eb65f3195bf2701568cinto the existing branch, without rebasing or force-pushing. The conflict resolution retains both this PR's atanh test calls/debt entry and main's log10/log2 calls/debt entries. The atanh implementation is byte-identical to prior public head72a6683e64531e4fc948e6115af96037b367ab5e.Linux x86-64, Arch 7.2.11-arch1-1, Ryzen 9 7950X, GCC 16.2.1, Ninja Release,
BUILD_TESTING=ON, pinned dependency worktrees. Rebuilt actual libc and the math/exact-math/Dinkumware targets.guest_math,guest_math_exact,guest_dinkumware_internals,public_headers: 4/4 pass, zero skips.Final-tree negative control: the same frozen math executable aborts under GDB at
CheckAtanhConsoleBitswhen onlyatanh_nid_postfixis replaced with the pre-topicreturn std::atanh(x)wrapper. All other production functions and every test are retained. Exact source restoration rebuilds libc byte-for-byte identically; all four checks pass again. Conventions and whitespace checks pass; worktree clean.Fresh build/control logs, JUnit, hashes and exact diff, SHA-256
abd0345d33231e5b624db479c7e01b85cca84b5329598e643a61595b4f78f85f.Earlier reference measurements retain their original source pins and scope; see prior exact-head qualification. At historical head
0a95fd8, Windows qualification and the supported-behavior host-wrapper negative control were complete; see that Windows follow-up for the exact pins, 12/12 initial and 12/12 restored passes, loaded-module path and verified artifact. No new bundled-library reference, console, title/GPU or performance execution is claimed. The separate #10565 follow-up addresses matching x87 exception flags; that behavior is not added here.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)