Skip to content

libc: sinhf and asinl are absent, first stops of Ruffle and RetroArch on main; bit-exact ports ready #3519

Closed

Description

@screamm

libc (libSceLibcInternal) does not export sinhf (NID 1t1-JoZ0sZQ) or asinl (NID Nx-F5v0-qU8). On current main 0f863c10 (fresh Windows relink, --windows --registry unused-filter=0) Ruffle Flash (PPSA68091) stops on sinhf and RetroArch (PPSA99169) on asinl:

FAIL: unresolved ELF import 1t1-JoZ0sZQ from libSceLibcInternal.prx
FAIL: unresolved ELF import Nx-F5v0-qU8 from libSceLibcInternal.prx

Fix branch ready: screamm:feat/libc-sinhf-asinl (two commits on main 0f863c10: 80ee7d83 feat(libc): implement sinhf, 62c4c7c3 feat(libc): implement asinl). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commits as they are. The closed #1702, #2037, #1405 and #2271 were host one-liners; this is different.

  • Both are bit-exact against the console's own code: the libc.prx bundled with PPSA28319 holds real code for sinhf (0x51d70) and asinl (0x429f0) under these NIDs; it was disassembled and run on this machine through a harness and compared with the ports. The console code is FreeBSD msun plus a Sony errno helper.
  • sinhf: a port of the older msun e_sinhf.c (FreeBSD 5aa554c7) with the expm1f/expf paths it reaches from stable/9 (59bc2f09); a host-expf version differed from the console on 4% of inputs by up to 4 ULP, the port matches on all 2,238,032,378 finite inputs up to the overflow threshold; above it errno ERANGE and ±inf with FE_OVERFLOW; NaN and ±inf return x + x, ±0 keeps its sign.
  • asinl: a port of e_asinl.c with the ld80 invtrig.c coefficients (9f043204), whose 80-bit constants the console binary holds; matches on 20 million random arguments in (-1, 1) plus the branch edges; ±1 gives ±pi/2 rounded to 64 bits; |x| > 1, ±inf and NaN raise FE_INVALID, set errno EDOM (NaN too, a Sony quirk) and return NaN. Nothing throws.
  • guest_math pins exact bits for every branch, sign and boundary plus the errno and floating-point flag behaviour. TechnicalDebt gets one bullet per function, including a finding beyond this change: on Windows a guest thread started with _beginthreadex runs the x87 unit at 53-bit precision, so every long double export is less precise in guest threads than on FreeBSD (64-bit); that belongs in guest thread creation.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: guest_math 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 533/534, the one failure being windows_exceptions (#3411); with main's Math.cpp the extended test fails; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux, no title run.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

Activity

  1. blawesom commented on Oct 11, 2026

    @blawesom
    Contributor

    Independent verification on Linux (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON.

    • Rebased 59bc2f09 onto current main: applies cleanly, no conflicts.
    • tools/check_conventions.py --base origin/main and git diff --check pass.
    • The extended math tests pass, including the new sinhf/asinl cases.
    • Full suite: 832/832 passed (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).

    The rebased branch is available at blawesom:verify/3519 for anyone carrying — the commit is otherwise unchanged.

  2. orishamir commented on Oct 11, 2026

    @orishamir
    Contributor

    RetroArch half on Windows: catalog build 1.0.0-beta.1 (sha256 checked, eboot.bin and sce_module/libc.prx unwrapped), relinked with --windows on main a11c8f7; Windows 11, RTX 4080, WinLibs GCC 15.2.0 r7, Release. Only libc.prx differs between the two runs.

    • main: FAIL: unresolved ELF import Nx-F5v0-qU8 from libSceLibcInternal.prx (asinl)
    • with the branch's Math.cpp (62c4c7c): FAIL: unresolved ELF import KvOHPTz595Y from libSceLibcInternal.prx (atanl)

    So RetroArch gets past asinl, and its next stop is atanl, one of the 43 exports of the closed #2271. For the Ruffle half, babyhuey's Linux run on #1702 shows Ruffle past sinhf (with #1702's line) and on to pause (#3552).

    AI-assisted: yes (Claude Code Opus 5.5 xhigh)

  3. Recapi commented on Oct 11, 2026

    @Recapi
    Contributor

    @screamm opened your branch as #3725, with both commits and your authorship unchanged, cherry-picked onto main a11c8f7 without conflicts. On Linux with the catalog builds: Ruffle Flash gets past sinhf to pause, and RetroArch gets past asinl to atanl. The rest of RetroArch's math imports (atanl through truncl, logb, remainder) are in #3598. With both PRs merged, RetroArch reaches pause too. I closed my own sinhf (#3597) and dropped asinl from #3598 in favour of your ports. If PPSA28319's libc.prx also has real code for any of the #3598 functions, a bit-exact check like the one you ran would be welcome.

  4. added a commit that references this issue on Oct 12, 2026
  5. Recapi commented on Oct 12, 2026

    @Recapi
    Contributor

    #3725 is merged (2c6e3f53, 5f3fb3dd, @screamm's commits unchanged), so sinhf and asinl are on main as your bit-exact ports. Thanks for the rebase. This issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions