feat(libc): implement long double, Bessel and integer math exports #7354

Merged
T3cm0 merged 1 commit from upstream-pr/7354 into main 2026-10-18 02:20:26 +00:00
T3cm0 commented 2026-10-18 01:43:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by T3cm0 on 2026-10-18T01:43:16Z.


What

Implements acoshl, asinhl, atanhl, atan2l, cbrtl, erfl, erfcl, expm1l, log1pl, log2l, lgammal, tgammal, hypotl, hypot3, hypot3f, hypot3l, j0f, j1f, jnf, y0f, y1f, ynf, labs, llabs, imaxabs, imaxdiv, scalbnl and significandf. hypot3* follow the Dinkumware code of the console's decrypted libSceLibcInternal.sprx (SDK 4.5x build of J03950001) (the first NaN is returned, an infinity gives +inf, otherwise the largest magnitude is combined with the hypot of the other two); lgammal leaves signgam alone as the console does. The transcendental functions use the host C library, so the last bits can differ from the console; this is in the debt file.

Replaces #7284, which the open PR limit closed before any of my pull requests was merged; GitHub does not let an author reopen a pull request the bot closed.

Tested

Windows 11 (MinGW GCC 15.2) and Ubuntu 26.04 on WSL2 (GCC 15.2), Release builds: ctest for guest_math passes on both, with all of this batch applied together and on its own. Compared with the console's own exports on a PS5 (firmware 13.60) from a homebrew payload that resolves them by NID: the special values and NaN ordering of every function in the test; the results match this implementation except where the debt file says otherwise. Not tested with a title.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4905531851 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7354). Originally posted by [T3cm0](https://github.com/T3cm0) on 2026-10-18T01:43:16Z. --- ### What Implements `acoshl`, `asinhl`, `atanhl`, `atan2l`, `cbrtl`, `erfl`, `erfcl`, `expm1l`, `log1pl`, `log2l`, `lgammal`, `tgammal`, `hypotl`, `hypot3`, `hypot3f`, `hypot3l`, `j0f`, `j1f`, `jnf`, `y0f`, `y1f`, `ynf`, `labs`, `llabs`, `imaxabs`, `imaxdiv`, `scalbnl` and `significandf`. `hypot3*` follow the Dinkumware code of the console's decrypted `libSceLibcInternal.sprx` (SDK 4.5x build of `J03950001`) (the first NaN is returned, an infinity gives +inf, otherwise the largest magnitude is combined with the hypot of the other two); `lgammal` leaves `signgam` alone as the console does. The transcendental functions use the host C library, so the last bits can differ from the console; this is in the debt file. Replaces #7284, which the open PR limit closed before any of my pull requests was merged; GitHub does not let an author reopen a pull request the bot closed. ### Tested Windows 11 (MinGW GCC 15.2) and Ubuntu 26.04 on WSL2 (GCC 15.2), Release builds: `ctest` for guest_math passes on both, with all of this batch applied together and on its own. Compared with the console's own exports on a PS5 (firmware 13.60) from a homebrew payload that resolves them by NID: the special values and NaN ordering of every function in the test; the results match this implementation except where the debt file says otherwise. Not tested with a title. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-18 01:43:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T01:43:50Z.


Progress report (0bb238b → 24a999c)

📈 System libraries: 90.11% (+0.07%, +28 implemented functions)

✅ 28 implemented
Library Name
libc acoshl_nid_postfix
libc asinhl_nid_postfix
libc atan2l_nid_postfix
libc atanhl_nid_postfix
libc cbrtl_nid_postfix
libc erfcl_nid_postfix
libc erfl_nid_postfix
libc expm1l_nid_postfix
libc hypot3_nid_postfix
libc hypot3f_nid_postfix
libc hypot3l_nid_postfix
libc hypotl_nid_postfix
libc imaxabs_nid_postfix
libc imaxdiv_nid_postfix
libc j0f_nid_postfix
libc j1f_nid_postfix
libc jnf_nid_postfix
libc labs_nid_postfix
libc lgammal_nid_postfix
libc llabs_nid_postfix
libc log1pl_nid_postfix
libc log2l_nid_postfix
libc scalbnl_nid_postfix
libc significandf_nid_postfix
libc tgammal_nid_postfix
libc y0f_nid_postfix
libc y1f_nid_postfix
libc ynf_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6244371051 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7354#issuecomment-6244371051). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T01:43:50Z. --- <!-- progress-report --> ### Progress report (0bb238b → 24a999c) 📈 **System libraries**: 90.11% (+0.07%, +28 implemented functions) <details> <summary>✅ 28 implemented</summary> | Library | Name | | - | - | | libc | `acoshl_nid_postfix` | | libc | `asinhl_nid_postfix` | | libc | `atan2l_nid_postfix` | | libc | `atanhl_nid_postfix` | | libc | `cbrtl_nid_postfix` | | libc | `erfcl_nid_postfix` | | libc | `erfl_nid_postfix` | | libc | `expm1l_nid_postfix` | | libc | `hypot3_nid_postfix` | | libc | `hypot3f_nid_postfix` | | libc | `hypot3l_nid_postfix` | | libc | `hypotl_nid_postfix` | | libc | `imaxabs_nid_postfix` | | libc | `imaxdiv_nid_postfix` | | libc | `j0f_nid_postfix` | | libc | `j1f_nid_postfix` | | libc | `jnf_nid_postfix` | | libc | `labs_nid_postfix` | | libc | `lgammal_nid_postfix` | | libc | `llabs_nid_postfix` | | libc | `log1pl_nid_postfix` | | libc | `log2l_nid_postfix` | | libc | `scalbnl_nid_postfix` | | libc | `significandf_nid_postfix` | | libc | `tgammal_nid_postfix` | | libc | `y0f_nid_postfix` | | libc | `y1f_nid_postfix` | | libc | `ynf_nid_postfix` | </details>
github-actions[bot] commented 2026-10-18 01:59:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T01:59:51Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/dev/debt/libc.md
PR 5303 docs/dev/debt/libc.md
PR 6044 core/libs/tests/GuestMath.cpp
PR 6154 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp
PR 6157 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp
PR 6158 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp
PR 6161 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp
PR 6163 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp
PR 6222 docs/dev/debt/libc.md
PR 6334 docs/dev/debt/libc.md
PR 6414 core/libs/prx/libc/src/Math.cpp
PR 6483 docs/dev/debt/libc.md
PR 6565 docs/dev/debt/libc.md
PR 6879 core/libs/prx/libc/src/Math.cpp
PR 7039 docs/dev/debt/libc.md
PR 7201 core/libs/prx/libc/src/Math.cpp
PR 7332 core/libs/prx/libc/src/Math.cpp
docs/dev/debt/libc.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6244500206 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7354#issuecomment-6244500206). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T01:59:51Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `docs/dev/debt/libc.md` | | [PR 5303](https://www.github.com/boykopovar/AnyPS5/pull/5303) | `docs/dev/debt/libc.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestMath.cpp` | | [PR 6154](https://www.github.com/boykopovar/AnyPS5/pull/6154) | `core/libs/prx/libc/src/Math.cpp`<br>`core/libs/tests/GuestMath.cpp` | | [PR 6157](https://www.github.com/boykopovar/AnyPS5/pull/6157) | `core/libs/prx/libc/src/Math.cpp`<br>`core/libs/tests/GuestMath.cpp` | | [PR 6158](https://www.github.com/boykopovar/AnyPS5/pull/6158) | `core/libs/prx/libc/src/Math.cpp`<br>`core/libs/tests/GuestMath.cpp` | | [PR 6161](https://www.github.com/boykopovar/AnyPS5/pull/6161) | `core/libs/prx/libc/src/Math.cpp`<br>`core/libs/tests/GuestMath.cpp` | | [PR 6163](https://www.github.com/boykopovar/AnyPS5/pull/6163) | `core/libs/prx/libc/src/Math.cpp`<br>`core/libs/tests/GuestMath.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `docs/dev/debt/libc.md` | | [PR 6334](https://www.github.com/boykopovar/AnyPS5/pull/6334) | `docs/dev/debt/libc.md` | | [PR 6414](https://www.github.com/boykopovar/AnyPS5/pull/6414) | `core/libs/prx/libc/src/Math.cpp` | | [PR 6483](https://www.github.com/boykopovar/AnyPS5/pull/6483) | `docs/dev/debt/libc.md` | | [PR 6565](https://www.github.com/boykopovar/AnyPS5/pull/6565) | `docs/dev/debt/libc.md` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/libs/prx/libc/src/Math.cpp` | | [PR 7039](https://www.github.com/boykopovar/AnyPS5/pull/7039) | `docs/dev/debt/libc.md` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libc/src/Math.cpp` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libc/src/Math.cpp`<br>`docs/dev/debt/libc.md` |
Sign in to join this conversation.
No reviewers
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!7354
No description provided.