Skip to content

feat(libc): implement nextafter and tgammaf exports - #1806

Closed
Prophet069 wants to merge 1 commit into
boykopovar:mainfrom
Prophet069:pr/libc-math-exports
Closed

Prophet069 wants to merge 1 commit into
boykopovar:mainfrom
Prophet069:pr/libc-math-exports

Conversation

@Prophet069

Copy link
Copy Markdown
Contributor

What

Add the missing nextafterf, nextafter and tgammaf libc exports. Titles importing these functions currently fail import resolution because their NIDs are absent from the built library.

The exports delegate to the matching float/double overloads of std::nextafter and std::tgamma, following the existing Math.cpp convention. Each uses extern "C", APS5_VABI and the _nid_postfix naming mechanism. No fallback values, title-specific behavior or new dependencies are introduced.

Add guest_math_exports, a CTest regression test for neighboring IEEE-754 values, equal arguments, signed zeros, subnormals, NaNs, infinities, gamma values, poles, domain errors and overflow/underflow. Floating-point exception and errno checks follow the host's advertised math_errhandling capabilities.

This PR contains only the three exports, their behavior test and its CMake registration. It is independent of the subsequent local developments.

Tested

Windows x86-64, MinGW-w64 GCC 15.2.0 UCRT, Release, CMake/Ninja. Built the full libc target, guest_math_exports_tests, guest_math_tests and nid_patcher from this PR's separate worktree, using at most four parallel jobs. Both guest_math_exports and guest_math passed; individual test durations were 0.12 s and 0.03 s.

Patched the freshly built libc.prx with the project's NID patcher and independently verified all three PE exports:

  • nextafterf: 3m2ro+Di+Ck
  • nextafter: h+J60RRlfnk
  • tgammaf: B2ZbqV9geCM

Reviewed ABI declarations: Windows uses the existing System-V APS5_VABI bridge; Linux uses its native System-V ABI. The implementation and regression test use portable C++20 facilities. Linux compilation and runtime tests were not performed because no usable Linux environment is available on this host; Linux CI validation remains outstanding. No converted title was started for this PR validation.

The official tools/check_conventions.py --base origin/main check was run with the planned title and this description supplied through --title and --body. It passed. The complete three-file diff was reviewed and git diff --check origin/main...HEAD passed.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes, OpenAI Codex. The submitting author is responsible for reviewing and validating every line.

@github-actions

github-actions Bot commented Oct 9, 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
#2001 core/libs/prx/libc/CMakeLists.txt L44-77
#2019 core/libs/prx/libc/CMakeLists.txt L48
#2058 core/libs/prx/libc/CMakeLists.txt L48
#2059 core/libs/prx/libc/CMakeLists.txt L48
#2060 core/libs/prx/libc/CMakeLists.txt L48

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title is shown to reach nextafterf, nextafter or tgammaf on main. Reopen with the title ID and the log line where it stops if you find one.

ycbuzi pushed a commit to ycbuzi/AnyPS5 that referenced this pull request Oct 10, 2026
… exports

Harvested from upstream (closed unmerged); library completion 2916/3290 -> 2918/3292. Additive conflicts resolved by keeping both sides: core/libs/prx/libc/CMakeLists.txt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011krDVCnnMQPaEFEqCDnKmA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants