fix(libc): compute j0f, j1f, y0f and y1f with the console's msun revision #21013
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21013"
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 kali113 on 2026-11-15T19:14:23Z.
What
j0f,j1f,y0fandy1fwere FreeBSD msun'se_j0f.cande_j1f.cat release/10.0.0. The libc debt file said the console's revision was unknown and probably an untagged 2014–2015 snapshot. This measures it and moves both files to that snapshot,a737ef56ab(only inline hints over8192c85cb3). The change ports those commits' cutoffs: the tiny-input limits, the large-input shortcut at 2^49 and thepzerof/qzerof/ponef/qoneftable thresholds.How the revision was found. A payload on a PS5 (firmware 13.590.001) called the four functions from the system
libSceLibcInternal.sprxby NID, on 26 arguments each, under MXCSR 0x1f80. I then compiled FreeBSD'se_j0f.cande_j1f.cat every commit that touched them from release/10.0.0 to 2018, with msun's ownsinf,cosfandlogf, and compared bit patterns:d300dc2302y1f)8192c85cb3,a737ef56ab186f620727and latery0f/y1fgive 0xffc00000, the console 0x7fc00000So the system module is this revision built with fused multiply-adds. This PR keeps the code unfused, as the
lgammaentry records for thelibc.prxmost titles bundle. That means AnyPS5 now equals FreeBSD ata737ef56ab, not the fused system module's last bit.What changes for titles. I scanned every 256th float from 2^-31 to 2^61 (3,014,656 arguments). Against
main, this changes:j1fon 13,946 arguments, all between 2.5 and 7.6;y1fon 254,057, across its range;j0fon 64 andy0fon 47.On that scan the new
j0fandj1fequal FreeBSD'sa737ef56abbit for bit.y0fandy1fdiffer on about 250 arguments both before and after this PR. The remaining gap is between this libc'ssinf/cosfports and the msun 11.4 copies used in the comparison, and this PR does not change it.The console also gave the negative-argument results the debt entry called unmeasured:
y0fandy1fof -1, -3.5 and -34.5 return 0x7fc00000 witherrnounchanged and no flags, and-infreturns a NaN with invalid. That is what this code already did, so the entry now records the measurement.Tested
j0f,j1f,y0f,y1f, 26 arguments each, as above.guest_bessel_testsandguest_math_testspass.j1f/y1ftable changed, at the old thresholds 2.5 and 2.857 and at 2^17.a737ef56abcompiled locally, and the build agrees on all of them.main'sJ0f.cppandJ1f.cpp,guest_bessel_testsaborts atj1f(2.5).python3 tools/check_conventions.py --base origin/mainpasses.tools/debt_fold.py --checkpasses.libc.prx.Open #18792 (jnf/ynf) calls
j0fandj1f. If its tests pin arguments in the changed ranges, one of the two will need its expected values updated after the other merges.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)Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-15T19:14:31Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T01:26:28Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
b856c64419:tools/check_conventions.pypassed;git diff --checkclean.guest_bessel_testsbuilt cleanly.guest_bessel):core/libs/prx/libc/src/J0f.cpp,core/libs/prx/libc/src/J1f.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.[j1f and y1f]and[j0f], but omits a## change [y0f]section. Becausecore/libs/prx/libc/src/J0f.cppalso updatesy0f_nid_postfix(lines 73, 76, 126, 129, 221, 230) to FreeBSD msun revisiona737ef56abandy0fwas measured on the console, the existingy0fentry indocs/dev/debt/libc.md(which statesy0ffollowsrelease/10.0.0with unmeasured console provenance and 10.0.0 thresholds) is now stale, as noted by maintaineroneandonlydean.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T09:17:49Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
49fb02fd68:tools/check_conventions.pypassed;git diff --checkclean.guest_bessel_testsbuilt cleanly.guest_bessel):core/libs/prx/libc/src/J0f.cpp,core/libs/prx/libc/src/J1f.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T09:33:13Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
ad66a84863:tools/check_conventions.pypassed;git diff --checkclean.guest_bessel_testsbuilt cleanly.guest_bessel):core/libs/prx/libc/src/J0f.cpp,core/libs/prx/libc/src/J1f.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me