Skip to content

feat(libc): implement llroundf - #2189

Closed
reyani-dev wants to merge 1 commit into
boykopovar:mainfrom
reyani-dev:feat/libc-llroundf
Closed

reyani-dev wants to merge 1 commit into
boykopovar:mainfrom
reyani-dev:feat/libc-llroundf

Conversation

@reyani-dev

Copy link
Copy Markdown
Contributor

What

Exports llroundf next to lroundf and llround, which round the same way: halfway cases away from zero, into a 64-bit result.

Title: PPSA99169 RetroArch imports it from libSceLibcInternal (resolved through libc.prx), per the #1578 audit. I haven't run the title.

Tested

Windows 11, WinLibs GCC 15.2.0 r7, Release, -DBUILD_TESTING=ON:

  • New checks in guest_math_tests, next to the llround case:
    • halfway cases away from zero (±2.5f);
    • -0.4f → 0;
    • results beyond 32 bits (2^33, -2^62);
    • 0.49999997f → 0, which floor(x + 0.5f) gets wrong because the sum rounds up to 1;
    • 16777215.f.
  • Mutation check: floor(x + 0.5f) and the host lround (32-bit long on Windows) each make guest_math fail.
  • cmake --build build --target libs: the patched libc.prx exports eQhBFnTOp40.
  • tools/check_conventions.py passes, and tools/pr_overlap.py --branch reports no overlap.

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

🤖 Generated with Claude Code

Export it next to lroundf and llround, rounding halfway cases away
from zero into the 64-bit guest long long.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Progress report (d70b899 → babc53f)

📈 System libraries: 84.7% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libc llroundf_nid_postfix

@reyani-dev

Copy link
Copy Markdown
Contributor Author

Full Linux and Windows builds and tests for this head (babc53fb), using the project's Build workflow. I can't start the upstream manual run, so I ran the same build.yml in my fork through a mirror PR. Like the upstream run, the jobs check out the PR head merged into current main (d70b8998):

Job Result
linux success; full build, ctest: 516/516 passed
windows success; full build, ctest: 507/507 passed
relinker (Linux, Windows, macOS) success

Run: https://github.com/AchrafReyani/AnyPS5/actions/runs/37922143613

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Same as #2167, for llroundf.

@babyhuey babyhuey mentioned this pull request Oct 10, 2026
9 tasks done
@babyhuey

Copy link
Copy Markdown
Contributor

This is now a title's next stop on current main, so here is the log line the close note asked for, plus a check of this branch.

Checked babc53f merged onto main c963432 (clean), Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC from WinLibs), Release.

  • guest_math passes 5/5 on both (--repeat until-fail:5); no CRT assertion dialog on Windows.
  • On main (catalog runs on 2edaf7f Linux and 0c0dc1e Windows) and with this branch:
Title main with this branch (Linux and Windows)
OpenRCT2 Native Port (PPSA99728) undefined symbol: eQhBFnTOp40 (llroundf) +my9jdHCMIQ (atol)

Example lines for OpenRCT2 Native Port (PPSA99728): main Windows FAIL: unresolved ELF import eQhBFnTOp40 (llroundf) from libSceLibcInternal.prx; with this branch, Linux app.elf: symbol lookup error: app.elf: undefined symbol: +my9jdHCMIQ, Windows FAIL: unresolved ELF import +my9jdHCMIQ from libSceLibcInternal.prx.

The next stop, atol, is #2186.

@reyani-dev

reyani-dev commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

@oneandonlydean this now has the evidence the close note asked for, thanks to @babyhuey's run above: OpenRCT2 Native Port (PPSA99728) stops at llroundf (eQhBFnTOp40) on current main and moves on to atol (#2186) with this branch. Could you reopen it? GitHub doesn't let me reopen a PR a maintainer closed. I also rechecked this branch merged onto current main on Windows: guest_math passes.

@reyani-dev reyani-dev mentioned this pull request Oct 10, 2026
9 tasks done
@reyani-dev

Copy link
Copy Markdown
Contributor Author

Resubmitted as #2933 now that intake allows it, rebased onto current main with the title evidence above.

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.

3 participants