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

Closed
opened 2026-10-11 12:10:31 +00:00 by screamm · 4 comments
screamm commented 2026-10-11 12:10:31 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T12:10:31Z.


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).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5800921479 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3519). Originally posted by [screamm](https://github.com/screamm) on 2026-10-11T12:10:31Z. --- 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`](https://github.com/screamm/AnyPS5/tree/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).
blawesom commented 2026-10-11 13:08:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T13:08:35Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109353860 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3519#issuecomment-6109353860). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T13:08:35Z. --- 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`](https://github.com/blawesom/AnyPS5/tree/verify/3519) for anyone carrying — the commit is otherwise unchanged.
orishamir commented 2026-10-11 13:15:45 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-11T13:15:45Z.


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 a11c8f7f; 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 (62c4c7c3): 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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109415972 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3519#issuecomment-6109415972). Originally posted by [orishamir](https://github.com/orishamir) on 2026-10-11T13:15:45Z. --- 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` a11c8f7f; 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` (62c4c7c3): `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)
Recapi commented 2026-10-11 16:01:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-11T16:01:31Z.


@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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110898847 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3519#issuecomment-6110898847). Originally posted by [Recapi](https://github.com/Recapi) on 2026-10-11T16:01:31Z. --- @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.
Recapi commented 2026-10-12 15:07:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-12T15:07:13Z.


#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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6126982786 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3519#issuecomment-6126982786). Originally posted by [Recapi](https://github.com/Recapi) on 2026-10-12T15:07:13Z. --- #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 in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#3519
No description provided.