fix(libc): compute _FSinh as titles do #12053
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12053"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-27T17:45:39Z.
What
_FSinh(x, y)used the host's binary64sinhand rounded the product to float. Thelibc.prxthat titles ship computes it in float instead (PPSA07923, file offset 0x87440). Witha = |x|:_FSinha < 2^-12a, ora * ywheny != 1a < 0x1.193ea8p-1(0.549)(a + a·z·c3) / ((z·c1 + c2)·z + 1) · y, wherez = a²a < 4(expm1f(−a)·(expm1f(a)·0.5) + expm1f(a)) · ya < 7.7((expm1f(−a)·0.5 + 1) · expm1f(a)) · y_FExp(&a, y, −1)The result is then negated for negative
x. Special operands keepmain's handling, which already followed the binary._FCoshis unchanged.8 of the 22 titles in my import audit import
_FSinh: PPSA01546, PPSA01826, PPSA02630, PPSA04158, PPSA05106, PPSA06369, PPSA09614 and PPSA09809.Tested
Current-main integration — 2026-11-04. Head
3e5969c5afee40cfda3b511820ba1a6b87cbeebeincludes mainb11c7bf84f5d2f636ff60166cc3371bd071e24d5and preserves previous public commits and attribution/licence notices. Retains the measured _FSinh implementation and fixtures; the earlier #11262/#11266 overlap-order note remains cleared as already resolved.Linux x86-64, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON: rebuilt actual libc/Ampr and selected executables.
guest_math,guest_math_exact,guest_dinkumware_internalseach pass 3/3 (9 runtime passes, zero skips);public_headers, conventions and whitespace checks pass. Pinned main passes all 17 selected baseline groups 3/3 (51 passes) plus headers. Before/after dependency checks agree: 34 recursive trees and 31,551 tracked blobs, zero errors; the update=none QuickJS test262 corpus is explicitly excluded from these library inputs.Source/parent/gitlink proofs, library/test hashes, raw logs/JUnit and head-leased push receipts: qualification archive, SHA-256
7c347f620951ad6f39068740750949212c6412815da094a46a96eca1d15c8bbf(download verified). Older platform, stress, negative-control and reference reports retain their original pins; no new Windows/macOS, full-suite, SDK-module, console, title/GPU or performance claim. AI-assisted: yes (Codex).Earlier dated qualifications below retain their original source/platform pins.
Current-head Linux verification:
69038db75f0ea94a864d8a0c8a9c6bbfab96179e, against main4f41f4c375f5abb487dbd184fbc150f31994d762. Linux 7.2.11 x86-64, GCC 16.2.1, Release, ASan off, bundled dependencies.Rebuilt
guest_math_tests,guest_math_exact_testsandguest_dinkumware_internals_testsfrom this clean head in an isolated build. 3/3 CTest groups pass, zero skips/failures. Loader checks confirm all three use that build's freshly built unpatchedlibc.prx.Current merge previews against main, #11262 and #11266 are clean. The reviewer confirmed the current function changes are disjoint; the old request for additional landing-order agreement is resolved. Both formerly listed prerequisites have merged; no open prerequisite remains. This follow-up verifies the library tests; console/title-module, Windows and performance comparisons retain their earlier tested pins.
Exact-head Linux results, JUnit and loader/merge evidence, SHA-256
7f58a115d8eefe406acd35fe08f3dec3341255aef03fa6b853b10109a25437f6.Earlier Windows/module comparison, tested head 68e4e4e8df
Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release,
BUILD_TESTING=ON. The head is68e4e4e8df, onmain228cd64b53plus #10222 and #12037.Comparison: a scratch loader runs the decrypted
libc.prxof 11 titles natively. It calls their_FSinhby NID and compares the result bits anderrnowith this build's.mainerrno0errno0The second group's
libc.prxcontracts multiply-adds to FMA, which portable C++ doesn't reproduce. Its remaining differences are one ulp, mostly in theexpm1frange.Tests in
guest_math:CheckScaledSineBitspins titles' bits for 10 arguments wheremainwas one ulp off. Each of the five branches gets at least one.CheckScaledHyperbolicrequires_FSinhwithin 2 ulp of a long double reference. That rule is stricter than titles are. With a subnormal multiplier,_FExproundsfactor·ybefore scaling, so titles lose most of the mantissa. For example,_FSinh(10, 2^-149)is0x00002000where the reference is0x00002b05. Near overflow, titles overflow early._FSinh(90, 1e-20)is finite (0x5ea95d6f) and_FSinh(90, 0)is+0.Results:
guest_mathandguest_dinkumware_internalspass in each of 3 runs on the head.Math.cppand these tests,guest_mathfails at_FSinh(0x1.9p+6, 0x1.16c2p-133).python tools/check_conventions.py --base origin/mainandgit diff --checkpass.Scope of that earlier comparison: no console, Linux/macOS module comparison, or flush-to-zero modes. The debt entry keeps the earlier PS5
libSceLibcInternalnote.Earlier Linux source-preservation/control artifacts retain their original pins: October 28, October 30.
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)f653b562a9a9)AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T18:36:51Z.
Review: DISMISSED
Reviewed head
68e4e4e8df2d367ae1fffd27ff620cf8eeb450c9. The algorithm is backed by substantial title-binary comparisons and focused tests in the description, but I did not rerun the numerical suite locally in this pass.\n\nThere is a repository-rule blocker: both open #11262 and #11266 modifycore/libs/prx/libc/src/Math.cpp, and an exact pairwisegit merge-treeagainst each current head reports a content conflict with this PR in that file. The checklist lists #10222 and #12037 as dependencies but does not mention either conflicting PR. Please coordinate merge order with those authors and record the agreed dependency/order on the checklist, then rebase and verify the combined changes/tests. This is required byCONTRIBUTING.mdfor overlapping PRs.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T09:03:14Z.
Review: COMMENTED
Re-checked — new head, overlap blocker cleared
The current heads merge cleanly, and the three PRs change different math exports, so the earlier overlap/order blocker no longer applies; I am not approving while the current checks and exact-head test evidence are incomplete.
What I ran
Reviewed all three changed files at head
69038db75f0ea94a864d8a0c8a9c6bbfab96179eagainst base4f41f4c375f5abb487dbd184fbc150f31994d762. I checked currentmainand pairwise previews against #11262 head0ecffe5ca55fe9aaa55cc30056cee882ad4fac47and #11266 head4c1383e2645bf2143dc15dbb1467f6d3bf6cf708. Environment: Debian 12, Linux x86_64, Python 3.11.2, Git 2.39.5. No compiler or local test binary was used.Results
GuestMath.cppasguest_math.69038db.Unedited check output
Precheck summary:
The two helper-script failures above are from missing workspace-only scripts in the isolated snapshot. I ran the ABI audit directly; it returned
"status": "passed"and"findings": []. The test-quality helper warning forGuestMath.cppwas manually checked against the exact-headcore/libs/prx/libc/CMakeLists.txt, which registers it asguest_math.Merge preview outputs (
exit=0means clean):Exact-head CMake registration:
Hosted status at the final refresh:
Negative control
Not run; this follow-up changes no code and no test. I did not independently rerun the numeric comparisons or the test's baseline control.
Findings
Blocking
None found in the current three-file source diff or the tested merge previews.
Non-blocking
_FSinh,atanlandexp2l; the latter PR already includes #11262. Because no changed lines or exports overlap and the pairwise previews are clean, no additional landing-order confirmation is required under the repository's overlap rule.340d12e.Sources
_FSinhimplementation at the reviewed head_FSinhcases at the reviewed headNot verified
I did not build or run
guest_math,guest_math_exactorguest_dinkumware_internalson69038db; I did not run the numeric comparison against title binaries, a console, or non-default flush-to-zero modes. The PR's earlier reported test runs are author-provided and do not cover this current head.To get this to a good state
Please update the stale merge-order note and provide exact-head results for the focused math tests, then let the pending checks finish. I will re-check the head and statuses before deciding whether approval is warranted.