Skip to content

feat(libc): implement the double nextafter export - #5418

Closed
Prophet069 wants to merge 1 commit into
boykopovar:mainfrom
Prophet069:codex/review-nextafter-double-20261013
Closed

Prophet069 wants to merge 1 commit into
boykopovar:mainfrom
Prophet069:codex/review-nextafter-double-20261013

Conversation

@Prophet069

Copy link
Copy Markdown
Contributor

What

Provide the missing double-precision nextafter guest export through std::nextafter. Tests check adjacent values, signed zero, NaNs, infinities, subnormal boundaries, errno and floating-point exceptions. This intentionally does not add nextafterf, which is already proposed in #2934.

Replaces the obsolete base of closed #2963, which was automatically closed for intake pause. Closed alternatives #4133/#4146 remain unmerged; this draft is for reviewing our existing PR rather than opening another duplicate.

Tested

Windows 10 Pro 22H2 x64 (build 19045), MinGW GCC 15.2.0: built the complete candidate libc.prx from this branch and ran the functional guest_nextafter regression successfully. Tests use synthetic guest-ABI inputs; no game startup, Linux/macOS build or maintainer CI run is claimed.

Based on main dacd78525e537a779682032c0ace7f7af120af05; candidate 036b7720c33b9e05f8984c10614a7293dc4d08e2. No dumps, runtime packages, investigation reports or images are included. No speed improvement is claimed.

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; no silent success stub added
  • No notes, investigation .md files or images added to the repository
  • New third-party code: none
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none (no clean-main Game bring-up claim)
  • GPUs tested: n/a (libc change)
  • AI-assisted: yes; prepared with Codex; the submitting author is responsible for every line

@github-actions

Copy link
Copy Markdown

Progress report (dacd785 → 036b772)

➖ System libraries: 88.15% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libc nextafter_nid_postfix

@johnohhh1

Copy link
Copy Markdown

Independent Linux validation of 036b7720c33b9e05f8984c10614a7293dc4d08e2, cleanly cherry-picked onto main a0f5916a293067ca840e835e58a8a55a0b764b4b, retaining the original author and stable patch ID.

Ubuntu 26.04.1 x86-64, GCC 15.2.0, Release, bundled dependencies, BUILD_TESTING=ON.

  • Before the patch, your GuestNextafter.cpp regression fails to link against baseline libc: undefined nextafter_nid_postfix.
  • With the patch, the full Linux build and six selected suites pass without skips: guest_nextafter, guest_math, guest_wide_conversion, guest_wide_strings, guest_strings, patched_libraries. Serial execution, 30-second per-test limit, 0.06 seconds total. Conventions and whitespace checks pass.
  • A separate guest-ABI probe passes 19,488 functional cases across all four rounding modes and three initial errno values. Non-NaN expected values are computed by an independent binary64 bit-stepping oracle, without calling host nextafter for the expected result. Cases include both signed zeros, adjacent values, normal/subnormal boundaries, finite extremes, infinities, deterministic randomized inputs, and quiet/signaling NaNs. It checks preserved errno for normal results, preservation of pre-existing exception flags, and signaling-NaN invalid exceptions. No failures in 74,380 assertions; approximately 0.008 seconds. The PR's own regression also passes its overflow/underflow errno and exception checks.

The value oracle follows C11 draft N1570, sections 7.12.11.3 and F.10.8.3. These are synthetic Linux checks, not console measurements or a title run. No additional Windows/macOS testing or full CTest-suite claim.

AI-assisted validation/report: Codex. No changes were made to your implementation.

@CnRJay CnRJay left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation itself looks fine. The description doesn't name a title that imports nextafter, though. Since #1205/#1208/#950, reviewers ask new-export PRs for the title ID and the log line where that title stops at the export on main (FAIL: unresolved ELF import ... from libc.prx), and export-only PRs without one have been closed. If you know of a title that reaches it (tools/import_audit.py over a title's imports will show it), adding that to the description should be all that's missing.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

@Prophet069

Copy link
Copy Markdown
Contributor Author

PPSA02015 reaches it

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.

4 participants