feat(libc): implement nan and nanf #3315
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3315"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T07:12:33Z.
What
Implement standard C99 quiet NaN generators
nanf(DZU+K1wozGI) andnan(zck+6bVj5pA) inlibc(core/libs/prx/libc/src/Math.cpp).std::nanfandstd::nan.nullptrtag pointer safely by defaulting to empty string"".core/libs/tests/GuestMath.cppverifying quiet NaN generation, null/empty/custom tag strings, and sign bit correctness.docs/dev/TechnicalDebt.md.Resolves start-up failure in VLC for PS5 (
PPSA85300, Issue #1578) on Linux, where execution stops atnanfafterstrsep(#3192).Tested
guest_math_testsexercisingnanf_nid_postfixandnan_nid_postfixwith null, empty, and tagged inputs.python tools/check_conventions.py --base 1690db9a2passes with zero findings.git diff --checkpasses with zero whitespace issues.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T07:12:41Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T07:12:55Z.
Progress report (
f8d8ae5→31906bf)📈 System libraries: 85.55% (+0.01%, +2 implemented functions)
✅ 2 implemented
nan_nid_postfixnanf_nid_postfixImported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T07:32:46Z.
The intake check closed this automatically. @adriadam10 @oneandonlydean @MarcZX100: Could one of you please reopen or carry this when convenient? It implements standard quiet NaN generators
nanf(DZU+K1wozGI) andnan(zck+6bVj5pA) in libc, which is the immediate runtime stop for VLC for PS5 (PPSA85300, issue #1578) on Linux now thatstrsep(#3192) has landed. It is cleanly rebased and mergeable onto currentmain(bd0692590) withMergeable: True, and passes all conventions and unit tests.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:06:40Z.
Review: CHANGES_REQUESTED
Thanks for this. Two things to change:
core/libs/prx/libc/src/Math.cpp:128-129: the console'slibc.prxignores the tag. Both exports (zck+6bVj5pA,DZU+K1wozGI) just load a global constant and return it (mov rax,[rip+..]; vmovsd xmm0,[rax]; ret).std::nan(tag)instead puts a payload in the result on glibc ("123"→ decimal 123), FreeBSD parses the tag as hex, and MinGW ignores it, so the result depends on the host. Return one fixed quiet NaN regardless of the tag (nostd::nan) and say where its bits come from.core/libs/tests/GuestMath.cpp:362-369: pin the exact bits (std::bit_cast) and use a tagged input that would change them on glibc ("123"), not justisnan.docs/dev/TechnicalDebt.md:554: the line is the last one of the file, which conflicts as soon as anyone else appends. Move it a few lines up inside "Functional", and mention that the tag is ignored.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:49:03Z.
Review: APPROVED
Checked against the console's
libc.prx:nan(zck+6bVj5pA) andnanf(DZU+K1wozGI) load a global through a relocation whose targets hold0x7ff8000000000000and0x7fc00000, which is what this returns regardless of the tag.guest_mathpasses and fails to link without the change; TechnicalDebt line is in place. Merging.