Skip to content

feat(libc): export isnanf and __signbitl - #3640

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
MarcZX10:feat/libc-math-predicate-exports-3624
Oct 12, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
MarcZX10:feat/libc-math-predicate-exports-3624

Conversation

@MarcZX10

Copy link
Copy Markdown
Contributor

What

Exports the missing isnanf (3pF7bUSIH8o) and __signbitl (Cj81LPErPCc) functions from libSceLibcInternal. XPSemu's import audit lists one reference to each; the following unresolved-import stops are predicted from registry order and have not been observed in a game run:

FAIL: unresolved ELF import 3pF7bUSIH8o from libSceLibcInternal.prx
FAIL: unresolved ELF import Cj81LPErPCc from libSceLibcInternal.prx

isnanf forwards to the existing __isnanf implementation. __signbitl returns exactly 0 or 1 using the host's x87 long double sign bit, with a compile-time size check for the guest ABI. Tests cover NaN, infinities, finite values, signed zero, and signed long-double NaN. Thanks to @screamm for confirming the imported NIDs, recording the FreeBSD 11.4 references, and identifying these XPSemu imports in #3624.

Tested

  • Linux, GCC 12.2, Release: built guest_math_tests; guest_math passed three consecutive runs.
  • python3 tools/check_conventions.py --base upstream/main and git diff upstream/main --check passed.
  • XPSemu was not run.

Checklist

  • Based on current main; no other open PR implements these 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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

@github-actions

Copy link
Copy Markdown

Progress report (a11c8f7 → e7c20b3)

📈 System libraries: 85.82% (+0.01%, +2 implemented functions)

✅ 2 implemented
Library Name
libc __signbitl_nid_postfix
libc isnanf_nid_postfix

@blawesom

Copy link
Copy Markdown
Contributor

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.

  • Builds; tools/check_conventions.py --base origin/main passes.
  • Full suite: 832/832 passed (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
#3905 core/libs/tests/GuestMath.cpp L442
#4164 core/libs/tests/GuestMath.cpp L38-39, L418

@babyhuey

Copy link
Copy Markdown
Contributor

I checked this PR on both OSes with Dusklight (PPSA99305, catalog build). With #3598 (logb) merged, Dusklight's next stop on main 5aaf26b is isnanf:

@oneandonlydean
oneandonlydean merged commit d146ec1 into boykopovar:main Oct 12, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants