feat(libc): export the std::__sce_v2 floating-point constants #15614

Merged
Danigamer05 merged 1 commit from upstream-pr/15614 into main 2026-11-07 20:48:49 +00:00
Danigamer05 commented 2026-11-03 21:53:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Danigamer05 on 2026-11-03T21:53:14Z.


What

Export the 22 versioned std::__sce_v2 floating-point constants from libc, with the bytes of the libc.prx bundled with PPSA03671 v01.001.005 (J03848509, SHA-256 483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6):

Export NID Original RVA Size Bytes
_ZNSt8__sce_v24_EpsE 3944SNcQyYo 0x167390 16 000000000000903c0000000000000000
_ZNSt8__sce_v24_InfE 6ECpKpHPngE 0x193930 16 000000000000f07f0000000000000000
_ZNSt8__sce_v24_NanE TnahhAHn6ps 0x193940 16 000000000000f87f0000000000000000
_ZNSt8__sce_v25_FEpsE RPuQ6aa91g8 0x167550 16 00000033000000000000000000000000
_ZNSt8__sce_v25_FInfE Do-8eQF2JcA 0x193970 16 0000807f000000000000000000000000
_ZNSt8__sce_v25_FNanE LOBN+nNuVEk 0x193980 16 0000c07f000000000000000000000000
_ZNSt8__sce_v25_LEpsE tTPVNqmkhlQ 0x168640 16 0000000000000080bd3f000000000000
_ZNSt8__sce_v25_LInfE 9SngnrNjveY 0x1939B0 16 0000000000000080ff7f000000000000
_ZNSt8__sce_v25_LNanE 4IZT9Rq60Ao 0x1939C0 16 00000000000000c0ff7f000000000000
_ZNSt8__sce_v25_SnanE uFFbdio7m-A 0x193950 16 010000000000f07f0000000000000000
_ZNSt8__sce_v25_XbigE X6Nutef9sZQ 0x1673B0 8 b0726891edbc3240
_ZNSt8__sce_v26_FSnanE AsmND1C0yHg 0x193990 16 0100807f000000000000000000000000
_ZNSt8__sce_v26_FXbigE dk4+7uNgSsg 0x167570 4 cdcc0a41
_ZNSt8__sce_v26_LSnanE Ge3ty+dRn70 0x1939D0 16 0100000000000080ff7f000000000000
_ZNSt8__sce_v26_LXbigE DKo0565tvWY 0x168660 16 00000000000000b00340000000000000
_ZNSt8__sce_v26_RtepsE OJAauE-Qzz4 0x1673A0 16 000000000000403e0000000000000000
_ZNSt8__sce_v27_DenormE qA86FNwaCsI 0x193910 16 01000000000000000000000000000000
_ZNSt8__sce_v27_FRtepsE 6Yp4XdIzJ7w 0x167560 16 00008039000000000000000000000000
_ZNSt8__sce_v27_LRtepsE vFrs9396f8s 0x168650 16 0000000000000080de3f000000000000
_ZNSt8__sce_v28_FDenormE ATy8lfrnzvg 0x193960 16 01000000000000000000000000000000
_ZNSt8__sce_v28_HugevalE MLJRfBChKVw 0x193920 16 000000000000f07f0000000000000000
_ZNSt8__sce_v28_LDenormE J5GM2EuBQG4 0x1939A0 16 01000000000000000000000000000000

They sit in Math.cpp beside the unversioned constants and use the same SonyDconst and LibcFloatConstant types:

  • _Denorm, _Hugeval, _Inf, _Nan, _Snan and their F and L forms hold the same bytes as the unversioned ones already in main, with the L forms in the 80-bit extended format.
  • _Eps, _FEps and _LEps are 2^-54, 2^-25 and 2^-66.
  • _Rteps, _FRteps and _LRteps are 2^-27, 2^-12 and 2^-33.
  • _Xbig is an 8-byte double (about 18.74), _FXbig a 4-byte float (about 8.675), and _LXbig the extended 22.0.

Tested

Windows x86-64, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON, main 04a9eb4fa28. Exact tested commit: 8b6573c6850.

  • Built libc, libkernel, their NID-patched production libraries and the related tests. The new guest_sce_v2_float_constants passes, along with guest_math and public_headers.
  • The new test compares every constant with the module's bytes over the module's size, and reads back _Eps, _Rteps, their F and L forms, and the three _Xbig values as numbers.
  • The original module was loaded with its relocations applied. For each of the 22 symbols, the bytes at its address, over the size its symbol table gives, match the patched production library's export with the same NID.
  • Negative control: four values were altered one at a time: the _Eps exponent, the last bit of _FXbig, the _LXbig exponent, and _Snan written as a quiet NaN. The new CTest and the byte comparison failed on each. The source was then restored byte for byte (SHA-256 checked) and rebuilt, and both passed again.
  • Code conventions and git diff --check pass.
  • tools/pr_overlap.py read 1,780 open PRs and reports no overlap. It keeps exit 2 for 31 branches that already conflict with main. None of them adds these names or NIDs, including the large data-export drafts #13449, #11750 and #11751. Merging each of the 31 with this branch and with main using git merge-tree gives the same conflict blocks. The branch also merges cleanly with #15336, #15471, #15484, #15490, #15501, #15519, #15552, #15561 and #15602.

Not tested: Linux, macOS, another SDK, a game, GPU or console. No game compatibility claim. No original module, extracted bytes, harness or log is committed or uploaded.

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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5145075831 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15614). Originally posted by [Danigamer05](https://github.com/Danigamer05) on 2026-11-03T21:53:14Z. --- ### What Export the 22 versioned `std::__sce_v2` floating-point constants from libc, with the bytes of the `libc.prx` bundled with PPSA03671 v01.001.005 (J03848509, SHA-256 `483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6`): | Export | NID | Original RVA | Size | Bytes | | --- | --- | --- | --- | --- | | `_ZNSt8__sce_v24_EpsE` | `3944SNcQyYo` | `0x167390` | 16 | `000000000000903c0000000000000000` | | `_ZNSt8__sce_v24_InfE` | `6ECpKpHPngE` | `0x193930` | 16 | `000000000000f07f0000000000000000` | | `_ZNSt8__sce_v24_NanE` | `TnahhAHn6ps` | `0x193940` | 16 | `000000000000f87f0000000000000000` | | `_ZNSt8__sce_v25_FEpsE` | `RPuQ6aa91g8` | `0x167550` | 16 | `00000033000000000000000000000000` | | `_ZNSt8__sce_v25_FInfE` | `Do-8eQF2JcA` | `0x193970` | 16 | `0000807f000000000000000000000000` | | `_ZNSt8__sce_v25_FNanE` | `LOBN+nNuVEk` | `0x193980` | 16 | `0000c07f000000000000000000000000` | | `_ZNSt8__sce_v25_LEpsE` | `tTPVNqmkhlQ` | `0x168640` | 16 | `0000000000000080bd3f000000000000` | | `_ZNSt8__sce_v25_LInfE` | `9SngnrNjveY` | `0x1939B0` | 16 | `0000000000000080ff7f000000000000` | | `_ZNSt8__sce_v25_LNanE` | `4IZT9Rq60Ao` | `0x1939C0` | 16 | `00000000000000c0ff7f000000000000` | | `_ZNSt8__sce_v25_SnanE` | `uFFbdio7m-A` | `0x193950` | 16 | `010000000000f07f0000000000000000` | | `_ZNSt8__sce_v25_XbigE` | `X6Nutef9sZQ` | `0x1673B0` | 8 | `b0726891edbc3240` | | `_ZNSt8__sce_v26_FSnanE` | `AsmND1C0yHg` | `0x193990` | 16 | `0100807f000000000000000000000000` | | `_ZNSt8__sce_v26_FXbigE` | `dk4+7uNgSsg` | `0x167570` | 4 | `cdcc0a41` | | `_ZNSt8__sce_v26_LSnanE` | `Ge3ty+dRn70` | `0x1939D0` | 16 | `0100000000000080ff7f000000000000` | | `_ZNSt8__sce_v26_LXbigE` | `DKo0565tvWY` | `0x168660` | 16 | `00000000000000b00340000000000000` | | `_ZNSt8__sce_v26_RtepsE` | `OJAauE-Qzz4` | `0x1673A0` | 16 | `000000000000403e0000000000000000` | | `_ZNSt8__sce_v27_DenormE` | `qA86FNwaCsI` | `0x193910` | 16 | `01000000000000000000000000000000` | | `_ZNSt8__sce_v27_FRtepsE` | `6Yp4XdIzJ7w` | `0x167560` | 16 | `00008039000000000000000000000000` | | `_ZNSt8__sce_v27_LRtepsE` | `vFrs9396f8s` | `0x168650` | 16 | `0000000000000080de3f000000000000` | | `_ZNSt8__sce_v28_FDenormE` | `ATy8lfrnzvg` | `0x193960` | 16 | `01000000000000000000000000000000` | | `_ZNSt8__sce_v28_HugevalE` | `MLJRfBChKVw` | `0x193920` | 16 | `000000000000f07f0000000000000000` | | `_ZNSt8__sce_v28_LDenormE` | `J5GM2EuBQG4` | `0x1939A0` | 16 | `01000000000000000000000000000000` | They sit in `Math.cpp` beside the unversioned constants and use the same `SonyDconst` and `LibcFloatConstant` types: - `_Denorm`, `_Hugeval`, `_Inf`, `_Nan`, `_Snan` and their `F` and `L` forms hold the same bytes as the unversioned ones already in main, with the `L` forms in the 80-bit extended format. - `_Eps`, `_FEps` and `_LEps` are 2^-54, 2^-25 and 2^-66. - `_Rteps`, `_FRteps` and `_LRteps` are 2^-27, 2^-12 and 2^-33. - `_Xbig` is an 8-byte `double` (about 18.74), `_FXbig` a 4-byte `float` (about 8.675), and `_LXbig` the extended 22.0. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows x86-64, WinLibs GCC 15.2.0, Release, `BUILD_TESTING=ON`, main `04a9eb4fa28`. Exact tested commit: `8b6573c6850`. - Built libc, libkernel, their NID-patched production libraries and the related tests. The new `guest_sce_v2_float_constants` passes, along with `guest_math` and `public_headers`. - The new test compares every constant with the module's bytes over the module's size, and reads back `_Eps`, `_Rteps`, their `F` and `L` forms, and the three `_Xbig` values as numbers. - The original module was loaded with its relocations applied. For each of the 22 symbols, the bytes at its address, over the size its symbol table gives, match the patched production library's export with the same NID. - Negative control: four values were altered one at a time: the `_Eps` exponent, the last bit of `_FXbig`, the `_LXbig` exponent, and `_Snan` written as a quiet NaN. The new CTest and the byte comparison failed on each. The source was then restored byte for byte (SHA-256 checked) and rebuilt, and both passed again. - Code conventions and `git diff --check` pass. - `tools/pr_overlap.py` read 1,780 open PRs and reports no overlap. It keeps exit 2 for 31 branches that already conflict with main. None of them adds these names or NIDs, including the large data-export drafts #13449, #11750 and #11751. Merging each of the 31 with this branch and with main using `git merge-tree` gives the same conflict blocks. The branch also merges cleanly with #15336, #15471, #15484, #15490, #15501, #15519, #15552, #15561 and #15602. Not tested: Linux, macOS, another SDK, a game, GPU or console. No game compatibility claim. No original module, extracted bytes, harness or log is committed or uploaded. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!15614
No description provided.