Repository navigation
fix(libc): compute hypotf with FreeBSD msun's algorithm, as titles' libc.prx does - #10328
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). |
7b2f887 to
5de85a2
Compare
|
Refreshed onto main379b1dca32 as5de85a223d54, one topic commit/no merges. Only an additive debt conflict needed resolving; main coshf and this hypotf entry are both retained. The hypotf implementation body is unchanged from7b2f8875c2. Fresh Linux libc build and guest_math/guest_dinkumware_internals each pass3/3; diff and conventions pass. New Linux build/test logs and rebase review are linked in the description. Earlier Windows/title-library sampling retains its original scope; it was not rerun for this rebase. |
harisibrar1
left a comment
There was a problem hiding this comment.
Checked against main 7966e59 and FreeBSD msun e_hypotf.c at release/9.0.0, 10.0.0, 11.4.0, 12.0.0 and 13.0.0:
- Thanks for this. The body matches release/11.4.0 line for line. 9.0.0 and 10.0.0 behave the same, since they only write the final scale as
0x3f800000+(k<<23), which equals(127+k)<<23for every reachable k, so the 11.4.0 link is the right one. From 12.0 on, the Inf/NaN line isfabsl(x+0.0L)-fabsf(y+0), so citing 11.4 rather than a newer release makes sense. - Emulating the algorithm in float reproduced all 12 non-special console vectors in
CheckHypotfConsoleBitsin both argument orders. The old double-hypotpath differs on 6 of them, including(0xc3a8012e, 0x47264372). - Optional: the only two-NaN case checks
(0xffc00002, 0x7fc00001), where I'd expect 11.4 and 12.0+ to agree. I couldn't run it, but reading the 12.0fabslline suggests the reversed pair(0x7fc00001, 0xffc00002)gives payload 1 with this code and payload 2 with 12.0+. If your title comparison has that pair's console bits, adding it would pin the version in the test. - Merges cleanly onto current main, and main's
hypotfis still the double-hypotcast.
Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
5de85a2 to
a46d099
Compare
|
Rebased onto main |
|
Windows run of a46d099 merged onto Built |
MarcZX10
left a comment
There was a problem hiding this comment.
The prior review and follow-up provide useful exact-head evidence, including the reversed quiet-NaN case and repeated guest_math/guest_dinkumware_internals runs on Linux and Windows. After refreshing upstream/main, however, this branch's merge base is 1e20650e8458, with 6,822 current-main commits since it. CONTRIBUTING.md asks contributors to keep branches up to date with main, and current hosted product jobs are skipped. Please update to current main and rerun guest_math and guest_dinkumware_internals on the resulting tree. The math implementation looks well supported on the old base; I will revisit approval when current-base integration is validated.
a46d099 to
60f77df
Compare
|
Refreshed onto current main as requested in review. Current-head Linux refresh (2026-10-25):
The earlier Windows/module comparisons below are historical; no fresh Windows, title or console run is claimed. Our Windows host remains explicitly user-paused. Download exact-head source pins, logs, JUnit, negative and restoration results; SHA-256 AI-assisted: yes (Codex). |
02e81eb to
91ef8d2
Compare
91ef8d2 to
3138227
Compare
hypotf carries over FreeBSD msun's lib/msun/src/e_hypotf.c at release/11.4.0. Name that source above the port, in the form the exp port uses, followed by the file's Sun copyright and permission notice copied verbatim from that revision. 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 @MarcZX10 This supplies the requested current-main math/exact/Dinkumware integration evidence on the final refreshed head. Please re-review when available. |
✅ AMD GPU test: passedPR head
Unstable on main (4, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (12, not counted against this PR)Validation IDs already present on main (8 IDs in 794 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. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 (2, 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)Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)Validated but not compared (64, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 802 tests)Skipped (62)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. |
|
Linux check of the current head Arch Linux 7.2.11, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, The earlier macOS relinker failure ( AI-assisted: yes |
✅ AMD GPU test: passedPR head
Unstable on main (5, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (11, not counted against this PR)Validation IDs already present on main (4 IDs in 808 tests)Skipped (69)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. |
# Conflicts: # core/libs/prx/libc/src/Math.cpp # core/libs/tests/GuestMath.cpp # docs/dev/debt/libc.md
|
Refreshed onto Resolution: I kept
Windows, WinLibs GCC 15.2 UCRT, Release:
AI-assisted: yes. |
|
Linux check of exact head
AI-assisted: yes |
❌ AMD GPU test: failedPR head
Failing testsThis PR changes test files, so each failing test was also built and run on main with only the PR's test changes applied. ✅ there means the failure comes from the PR's other changes; ❌ means the test fails on main too, so this run does not show the PR caused it.
agc_graphics_profile_draw: Timeout (also failed when re-run alone), assertion and diagnosticsUnstable on main (5, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (10, not counted against this PR)Passed on retry (2, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)Validated but not compared (65, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 808 tests)Skipped (71)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. |
|
Hi @JJenkx, I merged Linux check of the merge head (Release, |
What
hypotfrounded the host's doublehypotto float. That is almost always the correctly rounded result, but the titles' copy is not correctly rounded, so the two differ on 982,314 of 16 million random pairs. For example,hypotf(0xc3a8012e, 0x47264372)is0x472644c5on the console and0x472644c6here.The titles' copy (NID
iz2shAGFIxc) is FreeBSD msun'se_hypotf.c, computed in float.hypotfnow computes it:a + breturn when the ratio exceeds 2^30;sqrtfforms with the operands split at their low 12 bits.main's existinghypotftests still pass. They include the invalid exception for a signalling NaN next to an infinity, whichx + 0.0Fraises as in msun.hypot3fcalls thishypotf, and its existing tests still pass too.errno: neither msun nor the titles' copy sets it, even when a finite pair overflows to infinity, and this port sets none either.Tested
Current-main integration — 2026-11-03. Head
83dcad0259ea65fc6ffbd16ed56af75f5f003ee5includes 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. Whitespace check passes.Source/parent/gitlink proofs, exact library/test hashes, raw logs/JUnit, and head-leased push receipts: qualification archive, SHA-256
e6a50522bc28e30871fdc2c12a88d2537515914239e8166f6237f48895126a06(download verified). Older platform/reference reports retain their original pins; no new Windows/macOS, SDK-module, console, title/GPU or performance claim. AI-assisted: yes (Codex).Earlier dated qualifications below retain their recorded source/platform pins.
Current-main refresh — 2026-11-02. Published head
04983c615f878dc138be93f879e7e75106626283includes pinned maina4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8. The hypotf production body and CheckHypotfConsoleBits fixture remain unchanged. Main’s log10/log2/atan functions and test calls are retained. The refreshed topic is linear on pinned main with original authorship.Rebuilt actual libc/Ampr and selected tests from the final input tree.
guest_math,guest_math_exact,guest_dinkumware_internalseach pass three consecutive runs: 9 runtime passes, zero skips, plus public_headers. Conventions and whitespace pass. Source/input manifests, exact dependencies, library/test hashes, logs/JUnit and head-leased push receipts are attached. The same pinned main passes 18 selected groups three times (54 runtime passes) plus headers. All 34 recursive dependency trees/31,551 tracked blobs verify with zero errors; QuickJS’s update=none test262 corpus is explicitly excluded because it is not a library build input.Linux-7.2.11-arch1-1-x86_64-with-glibc2.44, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON. Focused Linux CPU qualification only. Older Windows/module/reference reports retain their original pins; no fresh Windows/macOS, SDK-module, console, title/GPU or speed claim. AI-assisted: yes (Codex).
Evidence: https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/math-six-main-a4eca-linux-extra10321-20261102.tar.gz; SHA-256 525ccb31a5d3d0f5adced5fda58818d8432f06c0afa7290139adb60ae6664b54.
Earlier dated qualifications below retain their recorded source/platform pins.
Rebased without merge commits onto main
73f4f7e06e4f210a8c6570e335fd654dc0a86134. Tested exact head33186d0401fffd98cbc1d1c552ff6f6b3f15767don Linux x86-64 (AMD Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON, bundled dependencies).Rebuilt
libc,guest_math_tests,guest_math_exact_testsandguest_dinkumware_internals_tests.guest_math,guest_math_exact,guest_dinkumware_internalsandpublic_headerseach pass three consecutive times on both pinned main and this exact head: 12 passes per side, zero skips. Conventions and whitespace checks pass. GitHub current-main integration is now backed by these local tests; the latest fetched main also has a clean merge preview.Original authored executable code and tests are preserved. The exp parent retains its FreeBSD notice; trailing whitespace was removed from three copyright-notice lines. No new Windows, macOS, bundled-SDK/console reference, GPU/title, performance or full-suite execution is claimed. Earlier reference comparisons retain their original source pins.
Source patches, source-preservation proof, exact pins, build logs, raw CTest logs, JUnit and binary hashes; SHA-256
46b6a1579d909a279510564f346f32b61073cc5d090decd6acc0684bfe6d706c. Uploaded copy downloaded and verified. AI-assisted: yes (Codex).Checklist
main; no other open PR implements the same functions. fix(libc): compute erf and erfc with FreeBSD msun's algorithm, as titles' libc.prx does #10321 and fix(libc): compute hypot with FreeBSD msun's algorithm, as titles' libc.prx does #10325 add their test functions and debt entries at the same places incore/libs/tests/GuestMath.cppanddocs/dev/debt/libc.md, so whichever of these PRs lands later needs those lines mergedNotImplemented_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 did