docs(libc): record nearbyintf, getw, putw, __isfinitel and _FSinh measured on a PS5 #10134

Closed
orezraey wants to merge 5 commits from upstream-pr/10134 into main
orezraey commented 2026-10-23 10:35:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orezraey on 2026-10-23T10:35:35Z.


What

Five libc debt entries said their console behaviour was unmeasured. I measured them on a retail PS5 (firmware 13.60) with a homebrew probe calling libSceLibcInternal.sprx from a payload process. The source and console log are in this gist (libc2). Only the debt file changes.

  • strtonum is not exported by libSceLibcInternal.sprx, so a payload cannot call it there.
  • nearbyintf rounds with the MXCSR mode. With the x87 mode set to upward and MXCSR to nearest it rounds 2.5 to 2; with MXCSR upward it gives 3. All four modes give the results the host gives, so AnyPS5 already matches. The console also raised FE_INEXACT for those inputs, which the host does not; the entry records it.
  • getw and putw match: two words written little-endian, -1 with end of file after them and for a 2-byte file, and -1 with the error flag for putw on a read-only stream.
  • __isfinitel matches: 1 for 0, -0, 1, a denormal and ±1e4000, and 0 for a NaN and for the maximum exponent without the integer bit.
  • _FSinh and _FCosh: 12 of 36 results differ from the console by one unit in the last place, namely _FSinh(0.5, y), _FCosh(1, y) and _FCosh(10, y) for y of 0.5, 1 and 2. Zeros, the overflow to infinity at 89 and 90, and the tiny-argument results matched. Matching bit for bit needs the console's float algorithm, so this records the gap.

Tested

tools/check_conventions.py passes. Documentation only.

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: #6713, #8937, #10113, #10226, #10345 (merge order only: they edit the same lines; this PR is refreshed after them); #9613 edits the same lines too (merge order only); #10742 adds an entry next to the same debt line (merge order only)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4981443854 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10134). Originally posted by [orezraey](https://github.com/orezraey) on 2026-10-23T10:35:35Z. --- ### What Five libc debt entries said their console behaviour was unmeasured. I measured them on a retail PS5 (firmware 13.60) with a homebrew probe calling `libSceLibcInternal.sprx` from a payload process. The source and console log are in [this gist](https://gist.github.com/orezraey/b230fdbb391a606b8ad8a9427276f40e) (`libc2`). Only the debt file changes. - **`strtonum`** is not exported by `libSceLibcInternal.sprx`, so a payload cannot call it there. - **`nearbyintf`** rounds with the MXCSR mode. With the x87 mode set to upward and MXCSR to nearest it rounds 2.5 to 2; with MXCSR upward it gives 3. All four modes give the results the host gives, so AnyPS5 already matches. The console also raised `FE_INEXACT` for those inputs, which the host does not; the entry records it. - **`getw` and `putw`** match: two words written little-endian, -1 with end of file after them and for a 2-byte file, and -1 with the error flag for `putw` on a read-only stream. - **`__isfinitel`** matches: 1 for 0, -0, 1, a denormal and ±1e4000, and 0 for a NaN and for the maximum exponent without the integer bit. - **`_FSinh` and `_FCosh`**: 12 of 36 results differ from the console by one unit in the last place, namely `_FSinh(0.5, y)`, `_FCosh(1, y)` and `_FCosh(10, y)` for y of 0.5, 1 and 2. Zeros, the overflow to infinity at 89 and 90, and the tiny-argument results matched. Matching bit for bit needs the console's float algorithm, so this records the gap. ### 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. --> `tools/check_conventions.py` passes. Documentation only. ### 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: #6713, #8937, #10113, #10226, #10345 (merge order only: they edit the same lines; this PR is refreshed after them); #9613 edits the same lines too (merge order only); #10742 adds an entry next to the same debt line (merge order only) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-23 10:51:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T10:51:09Z.

Review: CHANGES_REQUESTED


The documentation is supported by the linked firmware 13.60 probe: the nearbyintf rounding/MXCSR observations, getw/putw results, __isfinitel classifications, and the sampled _FSinh/_FCosh comparisons match the reported log. Exact-worktree conventions, diff-check, and main-sync pass (3 ahead/29 behind; merge clean); no runtime test applies to this documentation-only change. Please coordinate the docs/dev/debt/libc.md merge with #10129: the pairwise heads conflict in the adjacent guest-time-conversion / __isfinitel section, so preserve both updates in one refresh. Add Depends on only if one actually needs to land first. Hosted eligibility/intake/conventions/labels pass; product jobs are skipped for documentation-only paths.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5627220616 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10134#pullrequestreview-5627220616). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T10:51:09Z. **Review:** CHANGES_REQUESTED --- The documentation is supported by the linked firmware 13.60 probe: the nearbyintf rounding/MXCSR observations, getw/putw results, `__isfinitel` classifications, and the sampled `_FSinh`/`_FCosh` comparisons match the reported log. Exact-worktree conventions, diff-check, and main-sync pass (3 ahead/29 behind; merge clean); no runtime test applies to this documentation-only change. Please coordinate the `docs/dev/debt/libc.md` merge with #10129: the pairwise heads conflict in the adjacent guest-time-conversion / `__isfinitel` section, so preserve both updates in one refresh. Add `Depends on` only if one actually needs to land first. Hosted eligibility/intake/conventions/labels pass; product jobs are skipped for documentation-only paths.
MarcZX10 commented 2026-10-23 13:59:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T13:59:51Z.

Review: APPROVED


Re-review of exact current head aeb84055253aa07cf8d096fc48dbe9658efa1e80. This documentation-only change is backed by the linked firmware 13.60 probe and clearly records the observed nearbyintf, getw/putw, __isfinitel, and _FSinh/_FCosh results, including the measured one-ULP differences. Exact-head conventions and git diff --check pass; hosted eligibility, conventions and labels pass, with product jobs skipped for the documentation-only path.

The prior integration concern with #10129 is addressed: #10129 now explicitly declares Depends on: #10134 and carries the #10134 debt change until this PR lands. That preserves both adjacent documentation edits. Approving this exact head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5629291139 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10134#pullrequestreview-5629291139). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T13:59:51Z. **Review:** APPROVED --- Re-review of exact current head `aeb84055253aa07cf8d096fc48dbe9658efa1e80`. This documentation-only change is backed by the linked firmware 13.60 probe and clearly records the observed `nearbyintf`, `getw`/`putw`, `__isfinitel`, and `_FSinh`/`_FCosh` results, including the measured one-ULP differences. Exact-head conventions and `git diff --check` pass; hosted eligibility, conventions and labels pass, with product jobs skipped for the documentation-only path. The prior integration concern with #10129 is addressed: #10129 now explicitly declares `Depends on: #10134` and carries the #10134 debt change until this PR lands. That preserves both adjacent documentation edits. Approving this exact head.

Pull request closed

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!10134
No description provided.