feat(libc): implement the remaining long double math functions RetroArch imports #3598
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3598"
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 Recapi on 2026-10-11T14:06:16Z.
What
Implements the rest of the math functions that RetroArch (PPSA99169, catalog 1.0.0-beta.1) imports and
mainlacks (#1578): thelong doublefunctionsatanl,sinl,cosl,tanl,sinhl,coshl,tanhl,expl,exp2l,logl,log10l,powl,ldexplandtruncl, pluslogbandremainder. Each forwards to the host'sstd::function, asacosldoes.ldexpl,truncl,logbandremainderare exact operations, so they match the console. The transcendental ones can differ from the console's msun code in the last bit, and that is recorded inTechnicalDebt.md.sinhfandasinl, RetroArch's other two math imports, are in #3725, which carries @screamm's ports from #3519. Those ports match the console bit for bit. Earlier versions of this PR and #3597 carried host one-liners for them instead. The relinked title isBIND_NOW, so it needs both PRs to get past its math imports. The two PRs touch separate lines and merge with each other without conflicts.Tested
Linux (Ubuntu, GCC, Release) on
maina11c8f7. The catalog ZIP was checked against its sha256,eboot.binandsce_module/libc.prxwere unwrapped as #2605 requires, and the title was relinked with--registryand run in a sandbox with no network:main:./app.elf: symbol lookup error: ./app.elf: undefined symbol: Nx-F5v0-qU8(asinl)KvOHPTz595Y(atanl)./app.elf: symbol lookup error: ./app.elf: undefined symbol: EDyhWelj7UY(pause). Of RetroArch's 33 absent imports, 17 remain, and none of them is mathguest_mathpasses 3/3 (--repeat until-fail:3), both on this branch and merged with #3725. The newCheckExtendedMathcovers:atanl(inf)and the denormal edges ofexp2landldexpl;bc -lreferences;powlspecial cases,trunclnear 2^63, andlogb/remainderedge cases.check_conventions.pypasses. Fork CI for the previous version of this branch:guest_mathpassed on Linux and Windows (run 38145813373)Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T14:06:45Z.
Progress report (
1be2ca2→7663d84)📈 System libraries: 85.91% (+0.07%, +16 implemented functions)
✅ 16 implemented
atanl_nid_postfixcoshl_nid_postfixcosl_nid_postfixexp2l_nid_postfixexpl_nid_postfixldexpl_nid_postfixlog10l_nid_postfixlogb_nid_postfixlogl_nid_postfixpowl_nid_postfixremainder_nid_postfixsinhl_nid_postfixsinl_nid_postfixtanhl_nid_postfixtanl_nid_postfixtruncl_nid_postfixImported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-11T14:41:08Z.
Fork CI for this commit: run 38145813373.
guest_mathpasses on Linux and Windows. The failures in that run are unrelated to this change, and the Windows ones are the same as inmain's own run ona11c8f7(38144471410):guest_kernel_sys,windows_exceptionsagc_driver_emulated_color_compare,agc_driver_image_plane_address_on_li…,guest_kernel_stack_protectImported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T15:20:16Z.
Independent pre-review on Linux (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON.tools/check_conventions.py --base origin/mainpasses.Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-11T16:01:27Z.
Updated: dropped
asinlin favour of @screamm's console-exact port in #3725 (from #3519). This PR now has only the 16 functions that no other PR or branch implements. Thanks @blawesom for pointing out the overlap.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:40:59Z.
Checked the build and
guest_mathon Linux (libs + libc scope, 74/74 pass); the new cases fail to link without the change. No open PR adds these functions (#3725 carriessinhf/asinl).Added one commit:
TechnicalDebt.md:logbandremainderreturn the console's value, but glibc setserrno(ERANGEforlogb(0),EDOMforremainderby zero or of an infinity) where msun only raises the exception. The entry said they matched the console fully.Errno handling for the libm wrappers is tracked separately in #3690. Merging once CI is green.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:54:02Z.
Rebased onto current
main: the only conflict wasGuestMath.cpp, whereCheckAsinandCheckExtendedMathwere added at the same spot; both are kept.guest_mathpasses after the rebase. Merging once CI is green.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T21:56:52Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/tests/GuestMath.cppL85