fix(libc): compute hypotl with FreeBSD msun's ld80 code as the bundled libc.prx does #11634

Merged
AlexFigas merged 12 commits from upstream-pr/11634 into main 2026-11-17 20:56:31 +00:00
AlexFigas commented 2026-10-27 00:21:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlexFigas on 2026-10-27T00:21:32Z.


What

hypotl returned the host's hypotl after an infinity check. On 20,000,000 random pairs with nearby exponents, glibc's result differs from the console's on 539,841 of them, and its NaN bits on 729,412. For example, hypotl(0x8e0412b10b328599:4021, 0xa5e56711d52bca5e:c00f) is 0x8e0412b11140db2f:4021 on the console and …2e on the host.

The evidence is the libc.prx bundled with PPSA21564, build J03093718, the library's own code. Its hypotl (0x48b90, no calls) is FreeBSD msun's e_hypotl.c for ld80. This PR ports it operation for operation:

  • Order. Swap so that a has the larger exponent field, then take |a| and |b|.
  • Far apart. Return a + b when the exponent fields differ by more than 71.
  • ∞ and NaN. At an all-ones exponent, compute w = |x + 0| - |y + 0|; this raises FE_INVALID for ∞ - ∞, as the binary does. Return a or b if either is an infinity, otherwise w.
  • Huge. Above exponent field 0x5ff3, rebias both by −0x2058.
  • Tiny.
    • Below 0x200b with a normal exponent, rebias both by +0x2058.
    • A zero b returns a.
    • A nonzero b with a zero exponent field gives the default NaN with FE_INVALID, as below.
  • Middle. Split a (or 2a) and b by clearing the low 32 bits of the mantissa (ClearLowMantissaWord), then take fsqrt of the same exact-product expression.
  • Scale back. Multiply by 2^k, built from its bits.

The subnormal case follows the binary. When the argument with the smaller exponent field (y on a tie) is nonzero with a zero exponent field and the other is below 2^-16311, the binary returns the default NaN 0xc000000000000000:ffff and raises FE_INVALID, and so does this port.

  • In place of msun's 2^16382 scale factor, the binary loads 0x7fff:4000000000000000 (at 0x159dc0), a pseudo-NaN.
  • Its tiny path (0x48d6e to 0x48e24) uses that constant for a, b and w: after checking b's mantissa it never reads the arguments again and has no w > b test. It runs the w <= b arithmetic on the pseudo-NaN, and each operation is invalid or propagates the default NaN.
  • The port builds the same pseudo-NaN at run time and returns t1 + t1, the first of those operations (fadd st(0), st(0) at 0x48d99). Multiplying the arguments by it instead would leave w * (-w) on two default NaNs of opposite sign, for which the x87 returns the positive one whatever the operand order, so the result would be 0xc000000000000000:7fff.
  • So hypotl(3 * 2^-16445, 4 * 2^-16445) is that NaN here too, at every precision, and hypotl(3 * 2^-16445, -0) is still 3 * 2^-16445.

The binary has no control-word instruction (msun's ENTERI changes the precision only on i386), so it runs at the caller's x87 precision, and so does this port, as cbrtl does in #11632. The precision a guest thread starts with is #11849.

The debt fragment docs/dev/debt/changes/fix-libc-hypotl-msun-ld80.md adds an entry for hypotl that records that other SDK builds and the system libSceLibcInternal are not compared, and describes the subnormal case. The host-computed list drops hypotl. Its C11 F.10.4.3 note (∞ wins over NaN) moves to that entry; the port keeps that behaviour.

Licence. e_hypotl.c's notice is copied at the top of Math.cpp, after #11632's, behind a Derived from FreeBSD lib/msun/src/e_hypotl.c (release/11.4.0) line, the form #12541 uses. The source has a trailing space after "this notice"; it is dropped here, as asked on #12541, so git diff --check passes.

Tested

Head 6e37e8fcd4 is two commits on a4630de6b0 (oneandonlydean's merge of main 023c6eaf23). a4630de6b0 had left two copies of the host-computed list line in docs/dev/debt/libc.md, and the debt files are no longer edited directly (Fragments). 0fc7b591c1 merges main dcf3d15978 without a conflict and sets libc.md to main's; 6e37e8fcd4 adds docs/dev/debt/changes/fix-libc-hypotl-msun-ld80.md, which changes that line and adds the hypotl entry. With the fragment applied, tools/debt_fold.py --show libc gives main's line without hypotl and its C11 F.10.4.3 note, and the hypotl entry under Functional. (debt_fold.py --check stops on docs-nkwebkit-drop-readded-count-lines.md, which fails on main itself, so I ran it on a copy without that file.) The PR's diff of Math.cpp and GuestMath.cpp against main is line for line the same as at 360e13ebfa.

  • Windows, this head. Windows 11 (10.0.26300), WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r7), Release, BUILD_TESTING=ON, Ninja:
    • guest_math, guest_math_elementary and guest_math_exact pass 3 runs each.
    • With Math.cpp reverted to main's and the tests kept, guest_math aborts in 3 of 3 runs at Guest hypotl failed for 8000000000000000:0001, 8000000000000000:0001 with control word 037f; restored, it passes 3 of 3 again.
    • tools/select_tests.py selects 5828 of 5967 tests for the three changed files, on this head and on main dcf3d15978. The 129 tests that fail, are skipped or do not run on this head do the same on main; main also fails agc_driver_cached_image_multisample_guard. Not covered: Windows Defender quarantined 34 freshly linked AGC executables on both sides (33 tests and agc_shader_replay.exe, flagged as Trojan:Win64/ShellCode.MKA!MTB), so their tests did not run or failed, and agc_driver_upload_cache_read_only_flush_tests does not build on Windows (setenv, #19899).

The runs below are on Ubuntu 24.04 under WSL2 (GCC 13.3, Release). Head f51e83dd53 merges main 813f46cd68 (which has #11632) into the previous head c9e16f16bc, without a conflict. c9e16f16bc merged #11632's head b2a99b137f, which brings in main a4eca2a056, into 307aaca60f, with one conflict in docs/dev/debt/libc.md: main has #11849's shorter asinl entry directly below the hypotl entry, so the resolution kept main's asinl and this PR's hypotl. 307aaca60f merged #11632's head 5ab9b2926a, which brings in main e0caf13600, into cfee0b7fe5 (71ce66e0b1 and 68b7307f0a before it). Every run below is on f51e83dd53 except the negative control, made on the earlier head f6e7494db8, and the hosted run.

  • Native comparison. I used the harness from #11260, with that libc.prx's segments mapped into a Linux process, and ran the binary's hypotl next to this head's at 64, 53 and 24 bits under each rounding mode: 10,000,000 random pairs over every exponent (subnormals, ±∞, NaNs and non-canonical encodings included) and 10,000,000 pairs with exponent fields at most 80 apart, 240,000,000 calls in all. The results, NaN bits included, errno and the exception flags match on every pair, and the control word is unchanged after every call.

  • Negative control. With msun's 2^16382 factor put back, guest_math fails on hypotl(3 * 2^-16445, 4 * 2^-16445) and the same sweep reports result and flag differences on the subnormal path, for example FE_INVALID on the console and FE_INEXACT | FE_UNDERFLOW there.

  • guest_math and guest_math_exact pass 3 runs each. guest_math gains CheckHypotlConsoleBits, 24 known-answer pairs from that binary, each run at control word 0x037f and at 0x027f (53 bits) with the binary's result for that precision:

    • 3-4-5;
    • hypotl(max, max) overflowing to ∞;
    • the huge, tiny-normal and far-apart paths;
    • six pairs where glibc is one bit off, including the example above, 0x8e0412b11140e000:4021 at 53 bits;
    • ∞ with a NaN either way, a negative NaN, and −0;
    • the subnormal path: the default NaN with FE_INVALID for two subnormals, two larger subnormals of opposite sign, an unnormal with a subnormal, +0 with a subnormal, and a gap of 71 in the exponent field; the subnormal itself for a subnormal with −0.

    Each check requires the binary's result and x87 exception flags, no SSE flag, the same control word afterwards, and errno unchanged. The existing hypotl(3, -4) and hypotl(NaN, -∞) checks still pass.

  • Hosted run. On GitHub's ubuntu-latest runner (x86_64, GCC 13.3.0, Release), the earlier head 7e9165cb8b plus only a fork-only workflow commit (04a0367917) passes guest_math 3 runs (run).

  • Whole suite. Not rerun on this head, which changes only the subnormal branch and its checks; all 2536 tests passed on the earlier head 2850689af7.

  • Conventions. python3 tools/check_conventions.py --base upstream/main passes with 0 errors on 6e37e8fcd4, with this title and description. Its one warning is the length of the host-computed list entry the fragment changes, 1419 characters.

  • Overlap. On 6e37e8fcd4, python3 tools/pr_overlap.py --branch fix/libc-hypotl-msun-ld80 reports no pull request that shares lines or exports. It could not compare #6295, #7544 and #17026, which conflict with main and share Math.cpp and GuestMath.cpp; none of their diffs mentions hypotl.

    • #11632 and #11849 have merged, so the cbrtl entry, JoinExtended and the asinl entry are main's.
    • #12541 landed first, as agreed there; the notices it added stay unchanged, followed by #11632's block and this PR's.
    • #18694 and #18792 (both opened on November 12, after this PR) change the same host-computed list entry in their own fragments, to take out log1pl, acoshl, asinhl, atanhl and jnf, ynf. debt_fold.py refuses two fragments that change one entry, so whichever lands second has to rework its fragment against the line the first one leaves. This PR was opened and approved first, so I have not added a dependency.
  • Stacking. #11632 has merged, so this PR is now only the hypotl commit; it added JoinExtended and the test helper CallAtControlWord, which are on main.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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 (#11632 and #12541 have merged)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5026648999 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634). Originally posted by [AlexFigas](https://github.com/AlexFigas) on 2026-10-27T00:21:32Z. --- ### What `hypotl` returned the host's `hypotl` after an infinity check. On 20,000,000 random pairs with nearby exponents, glibc's result differs from the console's on 539,841 of them, and its NaN bits on 729,412. For example, `hypotl(0x8e0412b10b328599:4021, 0xa5e56711d52bca5e:c00f)` is `0x8e0412b11140db2f:4021` on the console and `…2e` on the host. The evidence is the `libc.prx` bundled with PPSA21564, build `J03093718`, the library's own code. Its `hypotl` (0x48b90, no calls) is FreeBSD msun's [`e_hypotl.c`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/lib/msun/src/e_hypotl.c) for ld80. This PR ports it operation for operation: - **Order.** Swap so that `a` has the larger exponent field, then take `|a|` and `|b|`. - **Far apart.** Return `a + b` when the exponent fields differ by more than 71. - **∞ and NaN.** At an all-ones exponent, compute `w = |x + 0| - |y + 0|`; this raises `FE_INVALID` for ∞ - ∞, as the binary does. Return `a` or `b` if either is an infinity, otherwise `w`. - **Huge.** Above exponent field `0x5ff3`, rebias both by −0x2058. - **Tiny.** - Below `0x200b` with a normal exponent, rebias both by +0x2058. - A zero `b` returns `a`. - A nonzero `b` with a zero exponent field gives the default NaN with `FE_INVALID`, as below. - **Middle.** Split `a` (or `2a`) and `b` by clearing the low 32 bits of the mantissa (`ClearLowMantissaWord`), then take `fsqrt` of the same exact-product expression. - **Scale back.** Multiply by `2^k`, built from its bits. **The subnormal case follows the binary.** When the argument with the smaller exponent field (`y` on a tie) is nonzero with a zero exponent field and the other is below 2^-16311, the binary returns the default NaN `0xc000000000000000:ffff` and raises `FE_INVALID`, and so does this port. - In place of msun's 2^16382 scale factor, the binary loads `0x7fff:4000000000000000` (at 0x159dc0), a pseudo-NaN. - Its tiny path (0x48d6e to 0x48e24) uses that constant for `a`, `b` and `w`: after checking `b`'s mantissa it never reads the arguments again and has no `w > b` test. It runs the `w <= b` arithmetic on the pseudo-NaN, and each operation is invalid or propagates the default NaN. - The port builds the same pseudo-NaN at run time and returns `t1 + t1`, the first of those operations (`fadd st(0), st(0)` at 0x48d99). Multiplying the arguments by it instead would leave `w * (-w)` on two default NaNs of opposite sign, for which the x87 returns the positive one whatever the operand order, so the result would be `0xc000000000000000:7fff`. - So `hypotl(3 * 2^-16445, 4 * 2^-16445)` is that NaN here too, at every precision, and `hypotl(3 * 2^-16445, -0)` is still `3 * 2^-16445`. The binary has no control-word instruction (msun's `ENTERI` changes the precision only on i386), so it runs at the caller's x87 precision, and so does this port, as `cbrtl` does in #11632. The precision a guest thread starts with is #11849. The debt fragment `docs/dev/debt/changes/fix-libc-hypotl-msun-ld80.md` adds an entry for `hypotl` that records that other SDK builds and the system `libSceLibcInternal` are not compared, and describes the subnormal case. The host-computed list drops `hypotl`. Its C11 F.10.4.3 note (∞ wins over NaN) moves to that entry; the port keeps that behaviour. **Licence.** `e_hypotl.c`'s notice is copied at the top of `Math.cpp`, after #11632's, behind a `Derived from FreeBSD lib/msun/src/e_hypotl.c (release/11.4.0)` line, the form #12541 uses. The source has a trailing space after "this notice"; it is dropped here, as asked on #12541, so `git diff --check` passes. ### 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. --> Head 6e37e8fcd4 is two commits on a4630de6b0 (oneandonlydean's merge of `main` 023c6eaf23). a4630de6b0 had left two copies of the host-computed list line in `docs/dev/debt/libc.md`, and the debt files are no longer edited directly ([Fragments](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#fragments)). 0fc7b591c1 merges `main` dcf3d15978 without a conflict and sets `libc.md` to `main`'s; 6e37e8fcd4 adds `docs/dev/debt/changes/fix-libc-hypotl-msun-ld80.md`, which changes that line and adds the `hypotl` entry. With the fragment applied, `tools/debt_fold.py --show libc` gives `main`'s line without `hypotl` and its C11 F.10.4.3 note, and the `hypotl` entry under Functional. (`debt_fold.py --check` stops on `docs-nkwebkit-drop-readded-count-lines.md`, which fails on `main` itself, so I ran it on a copy without that file.) The PR's diff of `Math.cpp` and `GuestMath.cpp` against `main` is line for line the same as at 360e13ebfa. - **Windows, this head.** Windows 11 (10.0.26300), WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r7), Release, `BUILD_TESTING=ON`, Ninja: - `guest_math`, `guest_math_elementary` and `guest_math_exact` pass 3 runs each. - With `Math.cpp` reverted to `main`'s and the tests kept, `guest_math` aborts in 3 of 3 runs at `Guest hypotl failed for 8000000000000000:0001, 8000000000000000:0001 with control word 037f`; restored, it passes 3 of 3 again. - `tools/select_tests.py` selects 5828 of 5967 tests for the three changed files, on this head and on `main` dcf3d15978. The 129 tests that fail, are skipped or do not run on this head do the same on `main`; `main` also fails `agc_driver_cached_image_multisample_guard`. Not covered: Windows Defender quarantined 34 freshly linked AGC executables on both sides (33 tests and `agc_shader_replay.exe`, flagged as `Trojan:Win64/ShellCode.MKA!MTB`), so their tests did not run or failed, and `agc_driver_upload_cache_read_only_flush_tests` does not build on Windows (`setenv`, #19899). The runs below are on Ubuntu 24.04 under WSL2 (GCC 13.3, Release). Head f51e83dd53 merges `main` 813f46cd68 (which has #11632) into the previous head c9e16f16bc, without a conflict. c9e16f16bc merged #11632's head b2a99b137f, which brings in `main` a4eca2a056, into 307aaca60f, with one conflict in `docs/dev/debt/libc.md`: `main` has #11849's shorter `asinl` entry directly below the `hypotl` entry, so the resolution kept `main`'s `asinl` and this PR's `hypotl`. 307aaca60f merged #11632's head 5ab9b2926a, which brings in `main` e0caf13600, into cfee0b7fe5 (71ce66e0b1 and 68b7307f0a before it). Every run below is on f51e83dd53 except the negative control, made on the earlier head f6e7494db8, and the hosted run. - **Native comparison.** I used the harness from #11260, with that `libc.prx`'s segments mapped into a Linux process, and ran the binary's `hypotl` next to this head's at 64, 53 and 24 bits under each rounding mode: 10,000,000 random pairs over every exponent (subnormals, ±∞, NaNs and non-canonical encodings included) and 10,000,000 pairs with exponent fields at most 80 apart, 240,000,000 calls in all. The results, NaN bits included, `errno` and the exception flags match on every pair, and the control word is unchanged after every call. - **Negative control.** With msun's 2^16382 factor put back, `guest_math` fails on `hypotl(3 * 2^-16445, 4 * 2^-16445)` and the same sweep reports result and flag differences on the subnormal path, for example `FE_INVALID` on the console and `FE_INEXACT | FE_UNDERFLOW` there. - **`guest_math` and `guest_math_exact` pass 3 runs each.** `guest_math` gains `CheckHypotlConsoleBits`, 24 known-answer pairs from that binary, each run at control word `0x037f` and at `0x027f` (53 bits) with the binary's result for that precision: - 3-4-5; - `hypotl(max, max)` overflowing to ∞; - the huge, tiny-normal and far-apart paths; - six pairs where glibc is one bit off, including the example above, `0x8e0412b11140e000:4021` at 53 bits; - ∞ with a NaN either way, a negative NaN, and −0; - the subnormal path: the default NaN with `FE_INVALID` for two subnormals, two larger subnormals of opposite sign, an unnormal with a subnormal, +0 with a subnormal, and a gap of 71 in the exponent field; the subnormal itself for a subnormal with −0. Each check requires the binary's result and x87 exception flags, no SSE flag, the same control word afterwards, and `errno` unchanged. The existing `hypotl(3, -4)` and `hypotl(NaN, -∞)` checks still pass. - **Hosted run.** On GitHub's `ubuntu-latest` runner (x86_64, GCC 13.3.0, Release), the earlier head 7e9165cb8b plus only a fork-only workflow commit (04a0367917) passes `guest_math` 3 runs ([run](https://github.com/AlexFigas/AnyPS5/actions/runs/40857728356)). - **Whole suite.** Not rerun on this head, which changes only the subnormal branch and its checks; all 2536 tests passed on the earlier head 2850689af7. - **Conventions.** `python3 tools/check_conventions.py --base upstream/main` passes with 0 errors on 6e37e8fcd4, with this title and description. Its one warning is the length of the host-computed list entry the fragment changes, 1419 characters. - **Overlap.** On 6e37e8fcd4, `python3 tools/pr_overlap.py --branch fix/libc-hypotl-msun-ld80` reports no pull request that shares lines or exports. It could not compare #6295, #7544 and #17026, which conflict with `main` and share `Math.cpp` and `GuestMath.cpp`; none of their diffs mentions `hypotl`. - #11632 and #11849 have merged, so the `cbrtl` entry, `JoinExtended` and the `asinl` entry are `main`'s. - #12541 landed first, as agreed there; the notices it added stay unchanged, followed by #11632's block and this PR's. - #18694 and #18792 (both opened on November 12, after this PR) change the same host-computed list entry in their own fragments, to take out `log1pl`, `acoshl`, `asinhl`, `atanhl` and `jnf`, `ynf`. `debt_fold.py` refuses two fragments that change one entry, so whichever lands second has to rework its fragment against the line the first one leaves. This PR was opened and approved first, so I have not added a dependency. - **Stacking.** #11632 has merged, so this PR is now only the `hypotl` commit; it added `JoinExtended` and the test helper `CallAtControlWord`, which are on `main`. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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 (#11632 and #12541 have merged) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-27 00:22:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T00:22:47Z.

Review: CHANGES_REQUESTED


This PR depends on #11632, but the new hypotl implementation has the same unresolved x87 precision-control requirement as cbrtl: the debt entry says it needs 64-bit precision, while Windows guest threads started through _beginthreadex use 53-bit precision. The implementation neither sets nor restores the x87 control word, and the reported 100-million-pair comparison was run under WSL2, so it does not establish correctness in the guest thread's Windows floating-point environment. A known-answer test under the host's default environment also does not cover this.

Please coordinate this with #11632 and make the result match the target independently of the caller's precision mode (preserving the caller's floating-point environment), or provide evidence that guest calls execute with 64-bit precision. Add tests that run the relevant cases at both 53-bit and 64-bit precision, including the reported one-bit-difference input. I cannot approve this stacked change while its documented runtime precision requirement is unmet.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5660823166 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5660823166). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T00:22:47Z. **Review:** CHANGES_REQUESTED --- This PR depends on #11632, but the new `hypotl` implementation has the same unresolved x87 precision-control requirement as `cbrtl`: the debt entry says it needs 64-bit precision, while Windows guest threads started through `_beginthreadex` use 53-bit precision. The implementation neither sets nor restores the x87 control word, and the reported 100-million-pair comparison was run under WSL2, so it does not establish correctness in the guest thread's Windows floating-point environment. A known-answer test under the host's default environment also does not cover this. Please coordinate this with #11632 and make the result match the target independently of the caller's precision mode (preserving the caller's floating-point environment), or provide evidence that guest calls execute with 64-bit precision. Add tests that run the relevant cases at both 53-bit and 64-bit precision, including the reported one-bit-difference input. I cannot approve this stacked change while its documented runtime precision requirement is unmet.
MarcZX10 commented 2026-10-27 11:01:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T11:01:23Z.

Review: COMMENTED


I reviewed the exact head 2850689af7c63b38bd18adb89153885a2eb4a5e8. The implementation handles the exponent-difference shortcut, infinities/NaNs, large values, subnormals, and compensated square accumulation in the same order described from the bundled module. Its tests cover the stacked cbrtl behavior as well as hypotl edge cases. I found no specific arithmetic defect in this pass.

Independent local check: I built and ran the exact guest_math_tests target natively on Linux; it exited 0. The hosted Windows check and Ubuntu/Windows relinker plus ASan checks pass. The two macOS relinker builds, macOS register-context jobs, and Intel write-watch job remain queued; the full Linux product job is skipped by path policy. Since this PR depends on #11632, I am leaving a comment review until the remaining platform checks finish and the dependency is integrated.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5665967644 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5665967644). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T11:01:23Z. **Review:** COMMENTED --- I reviewed the exact head 2850689af7c63b38bd18adb89153885a2eb4a5e8. The implementation handles the exponent-difference shortcut, infinities/NaNs, large values, subnormals, and compensated square accumulation in the same order described from the bundled module. Its tests cover the stacked cbrtl behavior as well as hypotl edge cases. I found no specific arithmetic defect in this pass. Independent local check: I built and ran the exact `guest_math_tests` target natively on Linux; it exited 0. The hosted Windows check and Ubuntu/Windows relinker plus ASan checks pass. The two macOS relinker builds, macOS register-context jobs, and Intel write-watch job remain queued; the full Linux product job is skipped by path policy. Since this PR depends on #11632, I am leaving a comment review until the remaining platform checks finish and the dependency is integrated.
MarcZX10 commented 2026-10-27 15:13:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T15:13:52Z.

Review: COMMENTED


I reviewed the current head bf6406e74d0b1f868e9830a8ef50161a89b63fe5. The hypotl path covers the exponent-gap shortcut, special values, large and tiny scaling, and compensated square accumulation. I did not find a new arithmetic defect in this pass. The documented bundled-binary subnormal discrepancy is explicit and has a focused test for the chosen msun behavior.

Local check: I applied the Math.cpp, GuestMath.cpp, and libc debt changes from #11632 and #11634 to a clean #11213-based checkout, built guest_math_tests in Release, and ran guest_math three times; all three passed. The combined tree includes #11213's unrelated exception changes, so this verifies the focused math sources and tests, not a literal build of this exact commit.

The hosted Windows, Ubuntu/macOS relinker, Ubuntu register-context, Windows, and ASan checks pass. The macOS x86_64 relinker, Intel Debug register-context, and Intel write-watch checks are still queued, and the Linux product job is skipped by path policy. This PR declares its dependency on #11632. I am leaving a comment review until that dependency is resolved and the queued platform checks finish.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5669517517 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5669517517). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T15:13:52Z. **Review:** COMMENTED --- I reviewed the current head bf6406e74d0b1f868e9830a8ef50161a89b63fe5. The `hypotl` path covers the exponent-gap shortcut, special values, large and tiny scaling, and compensated square accumulation. I did not find a new arithmetic defect in this pass. The documented bundled-binary subnormal discrepancy is explicit and has a focused test for the chosen msun behavior. Local check: I applied the `Math.cpp`, `GuestMath.cpp`, and libc debt changes from #11632 and #11634 to a clean #11213-based checkout, built `guest_math_tests` in Release, and ran `guest_math` three times; all three passed. The combined tree includes #11213's unrelated exception changes, so this verifies the focused math sources and tests, not a literal build of this exact commit. The hosted Windows, Ubuntu/macOS relinker, Ubuntu register-context, Windows, and ASan checks pass. The macOS x86_64 relinker, Intel Debug register-context, and Intel write-watch checks are still queued, and the Linux product job is skipped by path policy. This PR declares its dependency on #11632. I am leaving a comment review until that dependency is resolved and the queued platform checks finish.
MarcZX10 commented 2026-10-27 15:26:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T15:26:52Z.

Review: CHANGES_REQUESTED


I reviewed the current head bf6406e74d0b1f868e9830a8ef50161a89b63fe5. The ld80 hypotl path and the noncanonical/precision tests are otherwise well supported. The focused local guest_math run passed three times, and the hosted checks are now green.

I found one compatibility blocker in the explicitly documented subnormal case. For hypotl(3 * 2^-16445, 4 * 2^-16445), the bundled PPSA21564 libc.prx returns the default NaN and raises FE_INVALID, while this implementation returns msun's finite 5 * 2^-16445; the new test asserts the latter. The PR attributes the binary result to a probable compiler miscompile, but the other SDK builds and system libSceLibcInternal have not been compared. Since this change is presented as reproducing the console libc behavior, the single observed target binary is currently the only direct runtime evidence for this case.

Please either reproduce that measured behavior for the supported target, or provide evidence from the system library/another supported SDK showing that the msun result is the behavior AnyPS5 should emulate, and update the claim and regression coverage accordingly. I cannot approve a known behavior difference based only on an unverified miscompile explanation. The #11632 dependency and its separate debt-file ordering issue also remain unresolved.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5669748006 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5669748006). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T15:26:52Z. **Review:** CHANGES_REQUESTED --- I reviewed the current head bf6406e74d0b1f868e9830a8ef50161a89b63fe5. The ld80 hypotl path and the noncanonical/precision tests are otherwise well supported. The focused local guest_math run passed three times, and the hosted checks are now green. I found one compatibility blocker in the explicitly documented subnormal case. For hypotl(3 * 2^-16445, 4 * 2^-16445), the bundled PPSA21564 libc.prx returns the default NaN and raises FE_INVALID, while this implementation returns msun's finite 5 * 2^-16445; the new test asserts the latter. The PR attributes the binary result to a probable compiler miscompile, but the other SDK builds and system libSceLibcInternal have not been compared. Since this change is presented as reproducing the console libc behavior, the single observed target binary is currently the only direct runtime evidence for this case. Please either reproduce that measured behavior for the supported target, or provide evidence from the system library/another supported SDK showing that the msun result is the behavior AnyPS5 should emulate, and update the claim and regression coverage accordingly. I cannot approve a known behavior difference based only on an unverified miscompile explanation. The #11632 dependency and its separate debt-file ordering issue also remain unresolved.
MarcZX10 commented 2026-10-27 18:15:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T18:15:55Z.

Review: COMMENTED


I rechecked the updated head f6e7494db8ebb9b7e1d71f8d03aedc8c578b1328 and its delta from the previously reviewed head. The tiny-subnormal case now follows the observed PPSA21564 libc.prx result (0xc000000000000000:ffff, FE_INVALID), with regression vectors for the measured subnormal paths; the prior known-result discrepancy is addressed in code and debt text. git diff --check passes and the PR merges cleanly into the current main preview. The PR reports extensive current-head binary comparison and guest_math evidence, which I have not independently rerun on this updated head. Six macOS checks remain queued, and the declared dependency #11632 is still open, so I am leaving this as a comment review rather than approval.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5672170087 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5672170087). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T18:15:55Z. **Review:** COMMENTED --- I rechecked the updated head `f6e7494db8ebb9b7e1d71f8d03aedc8c578b1328` and its delta from the previously reviewed head. The tiny-subnormal case now follows the observed PPSA21564 `libc.prx` result (`0xc000000000000000:ffff`, `FE_INVALID`), with regression vectors for the measured subnormal paths; the prior known-result discrepancy is addressed in code and debt text. `git diff --check` passes and the PR merges cleanly into the current `main` preview. The PR reports extensive current-head binary comparison and `guest_math` evidence, which I have not independently rerun on this updated head. Six macOS checks remain queued, and the declared dependency #11632 is still open, so I am leaving this as a comment review rather than approval.
MarcZX10 commented 2026-10-27 19:33:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T19:33:01Z.

Review: APPROVED


I re-reviewed exact head f6e7494db8ebb9b7e1d71f8d03aedc8c578b1328 after the remaining validation completed. The author's fork-only Ubuntu run of guest_math on this head passes three runs; the previously queued upstream macOS checks have now all passed, along with Ubuntu, Windows, ASan and register-context checks. The upstream Linux product job is skipped for this PR's path filters.

My earlier focused local guest_math build/test also passed, and the arithmetic review found no defect in the tiny-subnormal handling or control-word preservation. The landing order is explicit: #11632 precedes this PR, which remains a declared prerequisite of #11849. No PS5 title run was performed. I approve the reviewed change and its available test evidence.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5673110813 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5673110813). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T19:33:01Z. **Review:** APPROVED --- I re-reviewed exact head f6e7494db8ebb9b7e1d71f8d03aedc8c578b1328 after the remaining validation completed. The author's fork-only Ubuntu run of guest_math on this head passes three runs; the previously queued upstream macOS checks have now all passed, along with Ubuntu, Windows, ASan and register-context checks. The upstream Linux product job is skipped for this PR's path filters. My earlier focused local guest_math build/test also passed, and the arithmetic review found no defect in the tiny-subnormal handling or control-word preservation. The landing order is explicit: #11632 precedes this PR, which remains a declared prerequisite of #11849. No PS5 title run was performed. I approve the reviewed change and its available test evidence.
MarcZX10 commented 2026-10-28 16:51:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T16:51:49Z.

Review: APPROVED


Re-reviewed exact current head 679a6c6eee95abae5e00037fd5cb8a3a366578c8. The post-approval changes add the required s_cbrtl.c and e_hypotl.c copyright/license notices directly above the corresponding ports; the notices match FreeBSD release/11.4.0. The previously reviewed tiny-subnormal behavior, tests and dependency on #11632 remain in place. Hosted Ubuntu, Windows, macOS, ASan, register-context and write-watch checks pass; Linux product is skipped by workflow filters. The author reports guest_math and binary comparisons on the new heads. No PS5 title run is claimed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5686449524 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5686449524). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T16:51:49Z. **Review:** APPROVED --- Re-reviewed exact current head `679a6c6eee95abae5e00037fd5cb8a3a366578c8`. The post-approval changes add the required `s_cbrtl.c` and `e_hypotl.c` copyright/license notices directly above the corresponding ports; the notices match FreeBSD release/11.4.0. The previously reviewed tiny-subnormal behavior, tests and dependency on #11632 remain in place. Hosted Ubuntu, Windows, macOS, ASan, register-context and write-watch checks pass; Linux product is skipped by workflow filters. The author reports `guest_math` and binary comparisons on the new heads. No PS5 title run is claimed.
MarcZX10 commented 2026-10-29 11:07:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T11:07:55Z.

Review: CHANGES_REQUESTED


Re-checked — changes requested

The notice is now positioned after #11632's as requested, and the update reports three guest_math runs on the PR and Ubuntu plus the bundled-libc hypotl sweeps. The branch is based on 1b580f13cf; current main is ba5b5330b3 and has changed Math.cpp, GuestMath.cpp and the libc debt file touched by this stack. Please integrate current main and rerun the focused math tests and hypotl comparison on the resulting exact head. I am not treating the previous-head approval as validation of the new integration.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5696706788 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5696706788). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T11:07:55Z. **Review:** CHANGES_REQUESTED --- ## Re-checked — changes requested The notice is now positioned after #11632's as requested, and the update reports three `guest_math` runs on the PR and Ubuntu plus the bundled-libc `hypotl` sweeps. The branch is based on `1b580f13cf`; current `main` is `ba5b5330b3` and has changed `Math.cpp`, `GuestMath.cpp` and the libc debt file touched by this stack. Please integrate current main and rerun the focused math tests and `hypotl` comparison on the resulting exact head. I am not treating the previous-head approval as validation of the new integration.
MarcZX10 commented 2026-10-30 10:20:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T10:20:37Z.

Review: CHANGES_REQUESTED


Re-checked — changes requested

Re-reviewed exact head 72ec427b783bf7f1638bb9f0ee668b54e3aa1b65; the remaining blocker is the maintainer-directed dependency on #12541, which this PR's checklist does not declare.

What I ran

The PR base is 98ddd9c1792bbab016ceed5db267a93d1d61f00a; current main is 07253ec3794121657a8d9a2229a6224651b0c8f5. A merge preview onto current main is clean. Among the PR's changed paths, current main has changed only docs/dev/debt/libc.md; Math.cpp and GuestMath.cpp are unchanged since the PR base. Local no-build checks ran on Linux (Debian, Python 3.11.2, GCC 12.2.0); I did not configure or build.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 11634
git fetch upstream main
git merge-tree --write-tree refs/remotes/upstream/main 72ec427b783bf7f1638bb9f0ee668b54e3aa1b65
git diff --name-only 98ddd9c1792bbab016ceed5db267a93d1d61f00a..refs/remotes/upstream/main -- core/libs/prx/libc/src/Math.cpp core/libs/tests/GuestMath.cpp docs/dev/debt/libc.md

Results

Check Result
Diff check and conventions Diff passed. Conventions passed with a non-failing 1,324-character debt-entry warning.
Current-main merge preview Clean; tree 887ca6389307599c8acdc026098eb49c8904fd65.
Hosted CI on this head Windows, relinker matrix, ASan, and register-context jobs passed; Linux product tests were skipped; two macOS write-watch jobs failed.
guest_math and bundled-libc comparison The author reports three exact-head test runs and 240 million hypotl comparisons across precisions/rounding modes; I did not independently run them.
Precheck helpers The isolated checkout lacks the local ABI/test-quality scripts. The stack helper reports a cycle, but the live dependency declarations are #11632 → #11634; the current blocking overlap is with #12541.
Selected unedited output
docs/dev/debt/libc.md:158: warning: [debt-length] Technical debt entry over 1000 characters: state the gap first (what differs from the console, what is unverified, what throws) and keep only the behaviour it needs: 1324 characters
1 findings, 0 errors; GitHub shows at most 10 error annotations, the job summary lists all
887ca6389307599c8acdc026098eb49c8904fd65
- PR #11634: Declared dependency cycle involving PRs [11632, 11634]

Findings

Blocking

The current checklist says Depends on: #11632, but maintainer direction on #12541 is to land #12541 first and declare Depends on: #12541 on both this PR and #11632. Both add license notices at the top of Math.cpp, so that insertion conflict needs an agreed and recorded order before approval. Please update this checklist to Depends on: #11632, #12541. After #12541 merges, rebase #11632 and then this PR onto the updated main in dependency order, keep both notice blocks, and obtain fresh CI.

Non-blocking

The conventions check warns that the modified libc debt entry is 1,324 characters, above its 1,000-character guidance. It is not a conventions error and does not block this review request.

Sources

Not verified

I did not build or run guest_math or the bundled-library comparison locally. The author-reported math results are on the exact PR head; the physical console was not tested. CI statuses above are from the exact-head snapshot and may change after this review.

To get this to a good state

Update the checklist to Depends on: #11632, #12541. After #12541 merges, rebase in dependency order and rerun fresh CI and focused math validation. I will rerun the same available no-build checks and inspect the resulting exact head before reviewing again.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5710907252 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5710907252). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T10:20:37Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes requested Re-reviewed exact head `72ec427b783bf7f1638bb9f0ee668b54e3aa1b65`; the remaining blocker is the maintainer-directed dependency on #12541, which this PR's checklist does not declare. ## What I ran The PR base is `98ddd9c1792bbab016ceed5db267a93d1d61f00a`; current `main` is `07253ec3794121657a8d9a2229a6224651b0c8f5`. A merge preview onto current `main` is clean. Among the PR's changed paths, current `main` has changed only `docs/dev/debt/libc.md`; `Math.cpp` and `GuestMath.cpp` are unchanged since the PR base. Local no-build checks ran on Linux (Debian, Python 3.11.2, GCC 12.2.0); I did not configure or build. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 11634 git fetch upstream main git merge-tree --write-tree refs/remotes/upstream/main 72ec427b783bf7f1638bb9f0ee668b54e3aa1b65 git diff --name-only 98ddd9c1792bbab016ceed5db267a93d1d61f00a..refs/remotes/upstream/main -- core/libs/prx/libc/src/Math.cpp core/libs/tests/GuestMath.cpp docs/dev/debt/libc.md ``` ## Results | Check | Result | |---|---| | Diff check and conventions | Diff passed. Conventions passed with a non-failing 1,324-character debt-entry warning. | | Current-main merge preview | Clean; tree `887ca6389307599c8acdc026098eb49c8904fd65`. | | Hosted CI on this head | Windows, relinker matrix, ASan, and register-context jobs passed; Linux product tests were skipped; two macOS write-watch jobs failed. | | `guest_math` and bundled-libc comparison | The author reports three exact-head test runs and 240 million `hypotl` comparisons across precisions/rounding modes; I did not independently run them. | | Precheck helpers | The isolated checkout lacks the local ABI/test-quality scripts. The stack helper reports a cycle, but the live dependency declarations are #11632 → #11634; the current blocking overlap is with #12541. | <details><summary>Selected unedited output</summary> ```text docs/dev/debt/libc.md:158: warning: [debt-length] Technical debt entry over 1000 characters: state the gap first (what differs from the console, what is unverified, what throws) and keep only the behaviour it needs: 1324 characters 1 findings, 0 errors; GitHub shows at most 10 error annotations, the job summary lists all ``` ```text 887ca6389307599c8acdc026098eb49c8904fd65 ``` ```text - PR #11634: Declared dependency cycle involving PRs [11632, 11634] ``` </details> ## Findings ### Blocking The current checklist says `Depends on: #11632`, but maintainer direction on #12541 is to land #12541 first and declare `Depends on: #12541` on both this PR and #11632. Both add license notices at the top of `Math.cpp`, so that insertion conflict needs an agreed and recorded order before approval. Please update this checklist to `Depends on: #11632, #12541`. After #12541 merges, rebase #11632 and then this PR onto the updated main in dependency order, keep both notice blocks, and obtain fresh CI. ### Non-blocking The conventions check warns that the modified libc debt entry is 1,324 characters, above its 1,000-character guidance. It is not a conventions error and does not block this review request. ## Sources - [Contribution rules at current main](https://github.com/boykopovar/AnyPS5/blob/07253ec3794121657a8d9a2229a6224651b0c8f5/CONTRIBUTING.md#L62-L69) - [Maintainer's landing-order instruction on #12541](https://github.com/boykopovar/AnyPS5/pull/12541#issuecomment-6520110624) - [Current #11634 review request](https://github.com/boykopovar/AnyPS5/pull/11634) ## Not verified I did not build or run `guest_math` or the bundled-library comparison locally. The author-reported math results are on the exact PR head; the physical console was not tested. CI statuses above are from the exact-head snapshot and may change after this review. ## To get this to a good state Update the checklist to `Depends on: #11632, #12541`. After #12541 merges, rebase in dependency order and rerun fresh CI and focused math validation. I will rerun the same available no-build checks and inspect the resulting exact head before reviewing again.
MarcZX10 commented 2026-10-30 15:00:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T15:00:39Z.

Review: CHANGES_REQUESTED


Re-checked — new head, changes requested

The earlier #12541 dependency-order finding is resolved, and this head includes #11632’s current reviewed head; the remaining blocker is that neither branch includes current main, as the repository rules require.

What I ran

Reviewed head 68b7307f0ac73a3e80660eed416aee3174575972 against PR base da026c70655a132031d45e2008c24f993870d801 on Debian 12 x86_64, Python 3.11.2, GCC 12.2.0. Current main is ed1e0ed08fc2452192df91793a33dd0cc7ad5212; the merge preview is clean.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 11634
git diff --check da026c70655a132031d45e2008c24f993870d801...68b7307f0ac73a3e80660eed416aee3174575972
git merge-tree --write-tree refs/remotes/upstream/main 68b7307f0ac73a3e80660eed416aee3174575972
gh pr checks 11634 --repo boykopovar/AnyPS5

Results

Check Result
Diff check Passed.
Conventions and manual ABI audit Hosted conventions passed; direct ABI audit passed.
Merge preview Clean onto current main; preview tree 7977071409095684a366f0485e288bcf3f78f0d5.
Dependency stack #11634 contains #11632 head 9d91493c28768bfaa7e63d5eb6c92263835139f7; checklist records #11632 and #12541 as already merged/included in the required order.
Math tests The author reports three guest_math runs and 24 ten-million-argument hypotl sweeps on this head. The 2,536-test full suite was reported on an earlier head; I did not run tests locally.
Hosted CI Windows, Ubuntu/Windows relinker, Ubuntu register-context, ASan, conventions, eligibility, labels, library-portability and report passed. Linux product tests were skipped; macOS relinker, register-context and write-watch jobs remain queued.
Precheck tooling Its ABI/test-quality helpers are absent from the isolated PR checkout; its stack parser reports a false-positive cycle despite the dependency head being included and the merge preview being clean.
Selected unedited output
7977071409095684a366f0485e288bcf3f78f0d5
dependency_head_included=0
relinker (ubuntu-latest, g++)	pass
relinker (windows-latest, g++)	pass
relinker (macos-latest, clang++)	pending
register-context (ubuntu-latest, Debug)	pass
register-context (macos-15-intel, Debug)	pending
write-watch (macos-15-intel)	pending
linux	skipping
windows	pass

Negative control

Not independently exercised. The reported comparison and focused-test runs are author-provided; I did not build an exact-head binary.

Findings

Blocking

This head contains main only through da026c70655a132031d45e2008c24f993870d801, while current main is ed1e0ed08fc2452192df91793a33dd0cc7ad5212. CONTRIBUTING.md requires keeping branches up to date. The merge preview is clean and the later main commits do not change this PR's source/test/debt paths, but the branch remains behind. Please update #11632 with current main first, then refresh #11634 on that updated dependency head, preserving the #11632 → #11634 → #11849 order.

Non-blocking

MacOS CI remains queued, the full suite was reported on an earlier head, and the precheck's stack-cycle result is inconsistent with its own clean dependency preview.

Sources

Not verified

No local build or CTest run; the reports of focused tests, comparison sweeps and the earlier full-suite run were not independently verified. No PS5-console run. The hosted macOS jobs are pending.

To get this to a good state

Update #11632 with current main, then refresh #11634 from that head and rerun the focused math tests on the resulting exact head. I will repeat the no-build checks and inspect that refreshed stack before reviewing again.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5714195237 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5714195237). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T15:00:39Z. **Review:** CHANGES_REQUESTED --- # Re-checked — new head, changes requested The earlier #12541 dependency-order finding is resolved, and this head includes #11632’s current reviewed head; the remaining blocker is that neither branch includes current `main`, as the repository rules require. ## What I ran Reviewed head `68b7307f0ac73a3e80660eed416aee3174575972` against PR base `da026c70655a132031d45e2008c24f993870d801` on Debian 12 x86_64, Python 3.11.2, GCC 12.2.0. Current `main` is `ed1e0ed08fc2452192df91793a33dd0cc7ad5212`; the merge preview is clean. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 11634 git diff --check da026c70655a132031d45e2008c24f993870d801...68b7307f0ac73a3e80660eed416aee3174575972 git merge-tree --write-tree refs/remotes/upstream/main 68b7307f0ac73a3e80660eed416aee3174575972 gh pr checks 11634 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | Diff check | Passed. | | Conventions and manual ABI audit | Hosted conventions passed; direct ABI audit passed. | | Merge preview | Clean onto current `main`; preview tree `7977071409095684a366f0485e288bcf3f78f0d5`. | | Dependency stack | #11634 contains #11632 head `9d91493c28768bfaa7e63d5eb6c92263835139f7`; checklist records #11632 and #12541 as already merged/included in the required order. | | Math tests | The author reports three `guest_math` runs and 24 ten-million-argument `hypotl` sweeps on this head. The 2,536-test full suite was reported on an earlier head; I did not run tests locally. | | Hosted CI | Windows, Ubuntu/Windows relinker, Ubuntu register-context, ASan, conventions, eligibility, labels, library-portability and report passed. Linux product tests were skipped; macOS relinker, register-context and write-watch jobs remain queued. | | Precheck tooling | Its ABI/test-quality helpers are absent from the isolated PR checkout; its stack parser reports a false-positive cycle despite the dependency head being included and the merge preview being clean. | <details><summary>Selected unedited output</summary> ```text 7977071409095684a366f0485e288bcf3f78f0d5 ``` ```text dependency_head_included=0 ``` ```text relinker (ubuntu-latest, g++) pass relinker (windows-latest, g++) pass relinker (macos-latest, clang++) pending register-context (ubuntu-latest, Debug) pass register-context (macos-15-intel, Debug) pending write-watch (macos-15-intel) pending linux skipping windows pass ``` </details> ## Negative control Not independently exercised. The reported comparison and focused-test runs are author-provided; I did not build an exact-head binary. ## Findings ### Blocking This head contains `main` only through `da026c70655a132031d45e2008c24f993870d801`, while current `main` is `ed1e0ed08fc2452192df91793a33dd0cc7ad5212`. `CONTRIBUTING.md` requires keeping branches up to date. The merge preview is clean and the later `main` commits do not change this PR's source/test/debt paths, but the branch remains behind. Please update #11632 with current `main` first, then refresh #11634 on that updated dependency head, preserving the #11632 → #11634 → #11849 order. ### Non-blocking MacOS CI remains queued, the full suite was reported on an earlier head, and the precheck's stack-cycle result is inconsistent with its own clean dependency preview. ## Sources - [Branch synchronization rule at current main](https://github.com/boykopovar/AnyPS5/blob/ed1e0ed08fc2452192df91793a33dd0cc7ad5212/CONTRIBUTING.md#L60) - [Reviewed implementation at this head](https://github.com/boykopovar/AnyPS5/tree/68b7307f0ac73a3e80660eed416aee3174575972) - [#11632 prerequisite](https://github.com/boykopovar/AnyPS5/pull/11632) - [#12541 landing-order update](https://github.com/boykopovar/AnyPS5/pull/12541) ## Not verified No local build or CTest run; the reports of focused tests, comparison sweeps and the earlier full-suite run were not independently verified. No PS5-console run. The hosted macOS jobs are pending. ## To get this to a good state Update #11632 with current `main`, then refresh #11634 from that head and rerun the focused math tests on the resulting exact head. I will repeat the no-build checks and inspect that refreshed stack before reviewing again.
MarcZX10 commented 2026-11-01 01:11:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T01:11:23Z.

Review: APPROVED


Re-checked — new head, looks good

I found no new blocking issue at head cfee0b7fe5bc06e84423bfb0047a4a2fe5b82d28; it includes #11632's current head, merges cleanly onto current main, and Windows CI passed.

What I ran

Reviewed head cfee0b7fe5bc06e84423bfb0047a4a2fe5b82d28 against base 8a4fc62318a4b73b6895bf20a024c625efeb7c3b on Debian 12 x86_64, Python 3.11.2 and GCC 12.2.0. The preview onto current main (7c4dcf0ad84de7a473ce97bb21644c614f1c3bd3) merged cleanly, and the head contains #11632 at 02c58684e5413be99fbbd9d635c86927db187b9c.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 11634
git diff --check 8a4fc62318a4b73b6895bf20a024c625efeb7c3b...cfee0b7fe5bc06e84423bfb0047a4a2fe5b82d28
git merge-tree --write-tree upstream/main refs/anyps5/review/11634
git merge-base --is-ancestor refs/anyps5/review/11632 refs/anyps5/review/11634
git log --oneline 8a4fc62318a4b73b6895bf20a024c625efeb7c3b..upstream/main -- core/libs/prx/libc/src/Math.cpp core/libs/tests/GuestMath.cpp docs/dev/debt/libc.md
gh pr checks 11634 --repo boykopovar/AnyPS5

Results

Check Result
Diff and current-main preview Passed; preview tree 29249e9d9375ff97fac8956ac73e8fae8e0eccdb. No newer main commits touch the changed math, test, or debt paths.
Dependency Passed; #11632's reviewed head is an ancestor of this head.
Conventions Hosted check passed. The local precheck also reported a non-blocking debt-entry-length warning.
Hosted CI Windows, Linux/macOS relinker, ASan, and register-context jobs passed. Linux product tests were skipped. Two macOS write-watch jobs failed during CMake configuration because that test project registers duplicate names; the failure is outside this PR's changed paths.
Focused math validation The author reports guest_math and guest_math_exact passing three runs each, plus 24 console-differential hypotl sweeps of 10 million pairs per sweep across x87 precisions and rounding modes. I did not run these locally.
Precheck tooling The isolated checkout lacks the local-only ABI and test-quality helper scripts; its stack checker reports a cycle despite the exact dependency being included. I independently confirmed ancestry and the clean preview.
Selected unedited output
29249e9d9375ff97fac8956ac73e8fae8e0eccdb
write-watch (macos-15)	fail	40s	https://github.com/boykopovar/AnyPS5/actions/runs/41256620753/job/124701565861
write-watch (macos-15-intel)	fail	1m23s	https://github.com/boykopovar/AnyPS5/actions/runs/41256620753/job/124701565875
windows	pass	5m25s	https://github.com/boykopovar/AnyPS5/actions/runs/41256620753/job/124701565877
linux	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41256620753/job/124701567027
CMake Error at CMakeLists.txt:42 (add_test):
  add_test given test NAME "write_watch_execute-fault" which already exists
CMake Error at CMakeLists.txt:42 (add_test):
  add_test given test NAME "write_watch_read-fault" which already exists

Sources

Not verified

No local C++ build or CTest run, no Linux product test, and no physical-console run. The extensive console-differential results above are author-reported, not independently reproduced.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5725836416 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5725836416). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T01:11:23Z. **Review:** APPROVED --- # Re-checked — new head, looks good I found no new blocking issue at head `cfee0b7fe5bc06e84423bfb0047a4a2fe5b82d28`; it includes #11632's current head, merges cleanly onto current `main`, and Windows CI passed. ## What I ran Reviewed head `cfee0b7fe5bc06e84423bfb0047a4a2fe5b82d28` against base `8a4fc62318a4b73b6895bf20a024c625efeb7c3b` on Debian 12 x86_64, Python 3.11.2 and GCC 12.2.0. The preview onto current `main` (`7c4dcf0ad84de7a473ce97bb21644c614f1c3bd3`) merged cleanly, and the head contains #11632 at `02c58684e5413be99fbbd9d635c86927db187b9c`. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 11634 git diff --check 8a4fc62318a4b73b6895bf20a024c625efeb7c3b...cfee0b7fe5bc06e84423bfb0047a4a2fe5b82d28 git merge-tree --write-tree upstream/main refs/anyps5/review/11634 git merge-base --is-ancestor refs/anyps5/review/11632 refs/anyps5/review/11634 git log --oneline 8a4fc62318a4b73b6895bf20a024c625efeb7c3b..upstream/main -- core/libs/prx/libc/src/Math.cpp core/libs/tests/GuestMath.cpp docs/dev/debt/libc.md gh pr checks 11634 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | Diff and current-main preview | Passed; preview tree `29249e9d9375ff97fac8956ac73e8fae8e0eccdb`. No newer `main` commits touch the changed math, test, or debt paths. | | Dependency | Passed; #11632's reviewed head is an ancestor of this head. | | Conventions | Hosted check passed. The local precheck also reported a non-blocking debt-entry-length warning. | | Hosted CI | Windows, Linux/macOS relinker, ASan, and register-context jobs passed. Linux product tests were skipped. Two macOS `write-watch` jobs failed during CMake configuration because that test project registers duplicate names; the failure is outside this PR's changed paths. | | Focused math validation | The author reports `guest_math` and `guest_math_exact` passing three runs each, plus 24 console-differential `hypotl` sweeps of 10 million pairs per sweep across x87 precisions and rounding modes. I did not run these locally. | | Precheck tooling | The isolated checkout lacks the local-only ABI and test-quality helper scripts; its stack checker reports a cycle despite the exact dependency being included. I independently confirmed ancestry and the clean preview. | <details><summary>Selected unedited output</summary> ```text 29249e9d9375ff97fac8956ac73e8fae8e0eccdb ``` ```text write-watch (macos-15) fail 40s https://github.com/boykopovar/AnyPS5/actions/runs/41256620753/job/124701565861 write-watch (macos-15-intel) fail 1m23s https://github.com/boykopovar/AnyPS5/actions/runs/41256620753/job/124701565875 windows pass 5m25s https://github.com/boykopovar/AnyPS5/actions/runs/41256620753/job/124701565877 linux skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41256620753/job/124701567027 ``` ```text CMake Error at CMakeLists.txt:42 (add_test): add_test given test NAME "write_watch_execute-fault" which already exists CMake Error at CMakeLists.txt:42 (add_test): add_test given test NAME "write_watch_read-fault" which already exists ``` </details> ## Sources - [FreeBSD 11.4 `s_cbrtl.c`](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/lib/msun/src/s_cbrtl.c) - [FreeBSD 11.4 `e_hypotl.c`](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/lib/msun/src/e_hypotl.c) - [Reviewed implementation and tests](https://github.com/boykopovar/AnyPS5/blob/cfee0b7fe5bc06e84423bfb0047a4a2fe5b82d28/core/libs/prx/libc/src/Math.cpp) ## Not verified No local C++ build or CTest run, no Linux product test, and no physical-console run. The extensive console-differential results above are author-reported, not independently reproduced.
MarcZX10 commented 2026-11-14 07:07:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T07:07:55Z.

Review: APPROVED


Reviewed — looks good

The hypotl port, regression cases, and technical debt entry were reviewed at the pinned head; no blocking defect was identified in the inspected changes.

What I ran

No commands or tests were run. The author reports Windows guest_math, guest_math_elementary, and guest_math_exact runs on this head; these were not independently run here.

Results

Check Result Note
Source and diff review passed Three changed files read
Tests in this review not run Author-reported results only

Findings

Blocking

None.

Non-blocking

None.

Not verified

The full test suite and all author-reported runs were not independently verified. The changed files listed as reviewed in the manifest were all read: core/libs/prx/libc/src/Math.cpp, core/libs/tests/GuestMath.cpp, and docs/dev/debt/libc.md. No files were listed as excluded in the supplied manifest; files.json was unavailable through the reader, so exclusions beyond that manifest are not verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5902516097 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5902516097). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T07:07:55Z. **Review:** APPROVED --- # Reviewed — looks good The `hypotl` port, regression cases, and technical debt entry were reviewed at the pinned head; no blocking defect was identified in the inspected changes. ## What I ran No commands or tests were run. The author reports Windows `guest_math`, `guest_math_elementary`, and `guest_math_exact` runs on this head; these were not independently run here. ## Results | Check | Result | Note | |---|---|---| | Source and diff review | passed | Three changed files read | | Tests in this review | not run | Author-reported results only | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The full test suite and all author-reported runs were not independently verified. The changed files listed as reviewed in the manifest were all read: `core/libs/prx/libc/src/Math.cpp`, `core/libs/tests/GuestMath.cpp`, and `docs/dev/debt/libc.md`. No files were listed as excluded in the supplied manifest; `files.json` was unavailable through the reader, so exclusions beyond that manifest are not verified. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-16 10:38:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T10:38:39Z.

Review: COMMENTED


Reviewed — no blocking findings

The inspected implementation follows the described hypotl paths, but I did not run checks on this exact head, so a formal approval is not justified.

What I ran

Head: 6e37e8fcd42dd4ca5812439639da6ac117a84249. I used repo_read.py to inspect the prepared description, commits, manifest, diff, and targeted source ranges. No build or tests were run by me.

Results

Check Result Note
Source review passed Three changed files inspected
Build and tests not run Author reports checks on earlier or other heads
Negative control not run No local execution available

Negative control

Not run by me. The description reports a negative control on an earlier head; I did not verify it.

Findings

Blocking

None identified in the inspected changes.

Non-blocking

No code change requested. The implementation and focused tests appear consistent with the stated goal in the ranges reviewed.

Sources

Not verified

I did not run the build, test suite, or negative control. The reported test results are author-provided; most are for earlier heads, and the description does not establish that they ran on this exact head. I reviewed the changed implementation and helper ranges, the new test function and call site, and the debt entry; I did not read every line of the two large C++ files. No changed files were excluded from the prepared diff.

To get this to a good state

Nothing is required. Optional: run the focused tests on this exact head before merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5918610554 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11634#pullrequestreview-5918610554). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-16T10:38:39Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The inspected implementation follows the described `hypotl` paths, but I did not run checks on this exact head, so a formal approval is not justified. ## What I ran Head: `6e37e8fcd42dd4ca5812439639da6ac117a84249`. I used `repo_read.py` to inspect the prepared description, commits, manifest, diff, and targeted source ranges. No build or tests were run by me. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Three changed files inspected | | Build and tests | not run | Author reports checks on earlier or other heads | | Negative control | not run | No local execution available | ## Negative control Not run by me. The description reports a negative control on an earlier head; I did not verify it. ## Findings ### Blocking None identified in the inspected changes. ### Non-blocking No code change requested. The implementation and focused tests appear consistent with the stated goal in the ranges reviewed. ## Sources - [`Math.cpp` at reviewed head](https://github.com/boykopovar/AnyPS5/blob/6e37e8fcd42dd4ca5812439639da6ac117a84249/core/libs/prx/libc/src/Math.cpp#L1467-L1528) - [`GuestMath.cpp` at reviewed head](https://github.com/boykopovar/AnyPS5/blob/6e37e8fcd42dd4ca5812439639da6ac117a84249/core/libs/tests/GuestMath.cpp#L2448-L2487) - [`fix-libc-hypotl-msun-ld80.md` at reviewed head](https://github.com/boykopovar/AnyPS5/blob/6e37e8fcd42dd4ca5812439639da6ac117a84249/docs/dev/debt/changes/fix-libc-hypotl-msun-ld80.md) ## Not verified I did not run the build, test suite, or negative control. The reported test results are author-provided; most are for earlier heads, and the description does not establish that they ran on this exact head. I reviewed the changed implementation and helper ranges, the new test function and call site, and the debt entry; I did not read every line of the two large C++ files. No changed files were excluded from the prepared diff. ## To get this to a good state Nothing is required. Optional: run the focused tests on this exact head before merging.
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!11634
No description provided.