fix(libc): compute asin and acos with FreeBSD msun's algorithm, as titles' libc.prx does #10253

Merged
JJenkx merged 17 commits from upstream-pr/10253 into main 2026-11-06 23:53:52 +00:00
JJenkx commented 2026-10-23 15:52:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-23T15:52:41Z.


What

asin and acos returned the host's functions, so their last bit and their errno depended on the host. For example, asin(0x3fef4102aaf38ef0) is 0x3ff5abc7e3600d9d on the console and 0x3ff5abc7e3600d9c on Windows (UCRT). Likewise acos(0x3fde7903ac7bb90a) is 0x3ff13151a8ce8628 there and 0x3ff13151a8ce8629 here.

For arguments outside [-1, 1], main's asin returns a negative NaN and raises FE_INVALID, but leaves errno alone (#3605, which followed FreeBSD's source). The titles' copy sets EDOM there. acos on main is the host's.

The titles' copies (NIDs 7Ly52zaL44Q and JBcgYuW8lPU) are FreeBSD msun's e_asin.c and e_acos.c. Both now compute them:

  • the |x| == 1 and |x| > 1 cases;
  • the tiny-argument shortcuts;
  • the pS/qS rational, written once as AsinRational because both files use the same coefficients;
  • the |x| < 0.5, 0.5 <= |x| < 0.975 and |x| >= 0.975 paths of asin, and the x < -0.5 and x > 0.5 paths of acos, with their sqrt split at the low word;
  • acos's pio2_lo, read at run time as msun's volatile read does.

errno: msun sets none, but the titles' copies set EDOM for every argument outside [-1, 1]: finite ones, the infinities, and every NaN. That is exactly msun's (x - x) / (x - x) return, which both ports now take. It gives the default negative NaN for non-NaN arguments, as main's asin tests expect, keeps a NaN argument's payload, and raises FE_INVALID itself. Arguments in [-1, 1] never set it.

Tested

Current-main refresh — 2026-11-04. Head 3135ae25861c85b24139896b133e7cbca68c9718 merges main 9ab6a281ea61c9e62a7eb07eb4cef8f19ede1c5c while retaining the prior public head as an ancestor. Main’s newer code, regression fixtures and debt entries are preserved alongside this topic.

Linux x86-64, GCC16.2.1, Ninja Release: actual libc, libkernel and libSceAmpr CMake owners rebuilt coherently. guest_math, guest_math_exact, guest_dinkumware_internals each pass three consecutive runs (9 passes, zero skips). The same groups pass three times on pinned main. Public-header audit and conventions pass. Original licence-notice trailing whitespace is retained where present. The scoped recipe reuses frozen ZArchive/zstd providers; this is not a whole-project build. No new Windows, bundled-SDK, physical-console, title/GPU or FPS measurement is claimed; earlier reports retain their original pins.

Exact source/parent proofs, per-branch patches/input manifests, build and CTest logs/JUnit, library/executable hashes and scoped CMake recipe, SHA-256 97a2377bc996be1690e8853e1ea090a98b5ed808bcc37a15a5cdada5c2e00845 (download verified). AI-assisted: yes (Codex).

Review follow-up — 7e375f18d465586d4e50d2893d4d2a9a840702e2. Restored main's float-trig debt wording: the existing TrigfKernelRemPio2 remains a separate one-word/precision-0 port, not shared with the new double reduction. Moved tan_nid_postfix and its complete s_tan.c notice together above the e_sinh.c notice, which again directly precedes sinh_nid_postfix. Trimmed the four notice-line trailing spaces. Executable tokens are unchanged except for the order of the tan definition; notice wording is retained.

Linux x86-64/GCC16.2.1 Release: rebuilt actual libc, guest_math_tests, and guest_math_exact_tests; both test groups pass three repetitions each (6 passes, zero skips). Conventions and git diff --check 4f41f4c375f pass. No new Windows, console, title or performance run is claimed. Review-fix patch, logs and source hashes, SHA-256 4ce442ee8617e329d8e5f1e6c36e628e65e921bf84421dcc4c15e50c88da1f2b (GitHub asset digest verified).

Current-main integration — 2026-11-03. Head af6e9e83fa50bfe3bff146f2560120f11b9f1d0a includes main 4f41f4c375f5abb487dbd184fbc150f31994d762 and retains the prior public history and attribution/licence notices. Main’s newer math implementations and fixtures remain alongside this topic. Main’s float argument-reduction tables, helper and TrigfRemPio2 remain byte-identical and separate from the retained topic double-trig implementation. Actual open prerequisite #10250 head 5c054e6b5e48aef1bde87b7f6c31b70a9e00d563 is an ancestor.

Linux x86-64 Release, GCC 16.2.1, Ninja, BUILD_TESTING=ON: rebuilt actual libc and math executables. guest_math, guest_math_exact, and guest_dinkumware_internals each pass 3/3 (9 passes, zero skips); public_headers and conventions pass. The same three groups pass 3/3 plus headers on pinned main. All 34 recursive dependency trees and 31,551 tracked blobs verify with zero errors; the update=none QuickJS test262 corpus is excluded from these library inputs. The four notice-line trailing spaces from this integration are removed in the follow-up below; no claim that main uses them remains.

Source/parent/gitlink proofs, exact library/test hashes, raw logs/JUnit, and head-leased push receipts: qualification archive, SHA-256 e6a50522bc28e30871fdc2c12a88d2537515914239e8166f6237f48895126a06 (download verified). Older platform/reference reports retain their original pins; no new Windows/macOS, SDK-module, console, title/GPU or performance claim. AI-assisted: yes (Codex).

Earlier dated qualifications below retain their recorded source/platform pins.

Current-main integration (2026-11-02): 2181a5edab48e035145cff5825c79240a87e8181 includes main a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8 and retains the existing public commits. Conflicts preserve main’s math implementations, regression checks and debt entries alongside this topic. Linux x86-64 Release, GCC 16.2.1: rebuilt libc and the three math executables; guest_math, guest_math_exact and guest_dinkumware_internals each pass three times (9 passes, zero skips), and public_headers passes. The same baseline groups pass on main; conventions and whitespace pass. Source and dependency blobs, executable/library hashes, raw logs and JUnit are retained. This refresh adds no new console, Windows, title, GPU or numerical-reference measurement. Qualification evidence, SHA-256 22866bd2a060ba69cd4387d471605afe20ed644e3257174b2d1488635f8c9b52 (download verified).

The current prerequisite #10250 head 5c054e6b5e48aef1bde87b7f6c31b70a9e00d563 is an ancestor of refreshed head af6e9e83fa50bfe3bff146f2560120f11b9f1d0a.

Main conflict refresh, 2026-10-27 10:18 UTC pass: exact head 57b6d204b0f7856c66cd6b997330c02dc9e5b83e on tested main 3fea2a937ba9fbab2f06c51691fe0c5763659aa3. The topic implementations and fixtures are retained alongside current main's newer math functions and coverage.

Linux Release focused rebuild: guest_math and guest_math_exact each pass three repetitions: 6 passes, zero skips. Conventions, whitespace and merge checks pass. Every refreshed head's submodule pointers match the pinned main; the private dependency checkouts used for the gates are aligned. No new negative-control, Windows, console, title, GPU, full-suite or performance run is claimed. Earlier measurements below retain their original exact pins. Fulfilled merge-order dependencies have been cleared from the checklist; open prerequisites remain.

Exact source/dependency pins, patch-preservation and gitlink proofs, builds, verbose tests, JUnit and lease-push receipts. SHA-256: 702c4110ee9dde421c2dd5e057ed53a2df05e0cf7b01f67e8fb9cb779e332f7c; downloaded copy verified.

Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release, BUILD_TESTING=ON, main 4be3da2c6f.

  • Comparison: a scratch loader runs the decrypted libc.prx of PPSA07923, PPSA05916 and PPSA13934 natively and supplies __error. It compared their asin and acos with this PR's code, checking result bits (NaN payloads included) and errno, on:

    • 16 million random arguments per title (half random bit patterns, half with exponents 2^-63 to 2^0);
    • 64,303 structured arguments: the 6,001 floats around ±1, ±0.5, ±0.975, ±2^-26 and ±2^-57; both sides of each high-word edge with three low words; every power of two from 2^-1074 to 2^1023, both signs; and the special values.

    Results:

    • PPSA07923 and PPSA05916: identical bits and errno on all of them.
    • PPSA13934: identical errno. The bits differ on 5,576 asin and 1,823 acos arguments, because that copy is an FMA-contracted build.
    • errno rule: the console sets EDOM on exactly the arguments outside [-1, 1].
  • guest_math: the new CheckAsinConsoleBits has 25 arguments, each with the console's asin and acos and its errno:

    • ±0, the 2^-57 and 2^-26 edges;
    • both sides of 0.5 and 0.975, the float below 1, and ±1;
    • the float above 1, 2 and ±inf;
    • NaN payloads of both signs;
    • three arguments per function where UCRT differs.

    main's existing asin checks still pass, except one. The check from #3605 that asin(2.0) leaves errno at 0 now expects EDOM, because both PPSA07923's and PPSA05916's asin(2.0) set it (and every other argument outside [-1, 1] does too). Its FE_INVALID checks, raised for 2.0 and not for a quiet NaN, are unchanged and pass. cc @CouchRiv: the NaN bits and flags from #3605 are kept; only the errno follows the console instead of FreeBSD's source.

    guest_math and guest_dinkumware_internals pass in three runs out of three on the exact head.

  • Negative control: with main's Math.cpp and these tests, guest_math aborts in a Require, while guest_dinkumware_internals still passes.

  • python tools/check_conventions.py --base origin/main and git diff --check pass.

  • Overlap and order: #9771 (asinf), #10222, #10229, #10234, #10245, #10247 and #10250, all mine, replace one-line host wrappers near asin's and acos's or add tests and debt entries at the same anchors, so they conflict textually. This PR lands last: #9777 → #9784 → #10222 → #9850 → #10229 → #10234 → #10245 → #10247 → #10250 → #10253 → the pow PR, with #10226 after #10222, #9857 before #10250 and #9771 before #10253. A combined preview of all twelve heads (5d16b438db, including #9857 and #9771) resolves every conflict by keeping each port and dropping each host wrapper. Each ported function is defined once and each console test is called once, and guest_math and guest_dinkumware_internals pass in three runs out of three on it.

  • Not tested: Linux and macOS (the result no longer depends on the host's functions), a console, the floating-point exception flags, and asinl/acosl.

Current Linux qualification (2026-10-28)

Rebased onto main 2227f1366188cda5699dd20e2e756a18006a5d4b. Linux CPU validation on 2026-10-28 at 5b96a875888056c5bd758270593be17d1a3f5542 (Arch Linux 7.2.9, AMD Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON).

libc, guest_math_tests and guest_math_exact_tests rebuilt from this exact source. guest_math and guest_math_exact each passed three consecutive runs (6/6, no skips); the same two suites each passed three runs on the pinned main (6/6). Conventions and whitespace checks pass.

Exact source pins, preservation proofs, dependency checks, build logs and JUnit, SHA-256 1176269c9e6948b5252a5db9e660978d7f978fb2d9f4ed6c68bc050b10b5ae68. This is focused Linux CPU qualification; earlier Windows/title/reference measurements retain their original pins. No new title or performance result is claimed.

Current Linux qualification — 2026-10-29

Refreshed against main 5454cd2e455994d992aca39335ce60507eeda1eb.

Linux qualification at ec98fb890ddb084b3a597798521e2c24260fb344 (Arch Linux 7.2.9, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON): guest_math, guest_math_exact, guest_dinkumware_internals each pass three consecutive runs (9/9, no skips). The public_headers audit passes at this exact head. All tracked public-header files match the pinned main; the affected test targets rebuild against those headers. Conventions and whitespace checks pass. The same focused groups passed three times on the pinned main.

Evidence: immutable Linux qualification bundle. Its SHA-256 is 53b095da2f67f55b8aa56ba273681e0330fb39739be844458038dde410fb8cc4. No fresh Windows runtime execution is claimed; older measurements retain their recorded source pins.

AI-assisted: yes (Codex).

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: none; the msun functions are rewritten, as #9668, #5036 and the sinhf entry did
  • Generic behaviour, not specific to one title
  • Depends on: #10250 (actual refreshed head 5c054e6b5e48aef1bde87b7f6c31b70a9e00d563)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4985484141 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10253). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-23T15:52:41Z. --- ### What `asin` and `acos` returned the host's functions, so their last bit and their `errno` depended on the host. For example, `asin(0x3fef4102aaf38ef0)` is `0x3ff5abc7e3600d9d` on the console and `0x3ff5abc7e3600d9c` on Windows (UCRT). Likewise `acos(0x3fde7903ac7bb90a)` is `0x3ff13151a8ce8628` there and `0x3ff13151a8ce8629` here. For arguments outside [-1, 1], `main`'s `asin` returns a negative NaN and raises `FE_INVALID`, but leaves `errno` alone (#3605, which followed FreeBSD's source). The titles' copy sets `EDOM` there. `acos` on `main` is the host's. The titles' copies (NIDs `7Ly52zaL44Q` and `JBcgYuW8lPU`) are FreeBSD msun's [`e_asin.c`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/lib/msun/src/e_asin.c) and [`e_acos.c`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/lib/msun/src/e_acos.c). Both now compute them: - the `|x| == 1` and `|x| > 1` cases; - the tiny-argument shortcuts; - the `pS`/`qS` rational, written once as `AsinRational` because both files use the same coefficients; - the `|x| < 0.5`, `0.5 <= |x| < 0.975` and `|x| >= 0.975` paths of `asin`, and the `x < -0.5` and `x > 0.5` paths of `acos`, with their `sqrt` split at the low word; - `acos`'s `pio2_lo`, read at run time as msun's `volatile` read does. **`errno`:** msun sets none, but the titles' copies set `EDOM` for every argument outside [-1, 1]: finite ones, the infinities, and every NaN. That is exactly msun's `(x - x) / (x - x)` return, which both ports now take. It gives the default negative NaN for non-NaN arguments, as `main`'s `asin` tests expect, keeps a NaN argument's payload, and raises `FE_INVALID` itself. Arguments in [-1, 1] never set it. ### Tested <!-- libc-main9ab-refresh-20261104-10253 --> **Current-main refresh — 2026-11-04.** Head `3135ae25861c85b24139896b133e7cbca68c9718` merges main `9ab6a281ea61c9e62a7eb07eb4cef8f19ede1c5c` while retaining the prior public head as an ancestor. Main’s newer code, regression fixtures and debt entries are preserved alongside this topic. Linux x86-64, GCC16.2.1, Ninja Release: actual libc, libkernel and libSceAmpr CMake owners rebuilt coherently. `guest_math`, `guest_math_exact`, `guest_dinkumware_internals` each pass three consecutive runs (**9 passes, zero skips**). The same groups pass three times on pinned main. Public-header audit and conventions pass. Original licence-notice trailing whitespace is retained where present. The scoped recipe reuses frozen ZArchive/zstd providers; this is not a whole-project build. No new Windows, bundled-SDK, physical-console, title/GPU or FPS measurement is claimed; earlier reports retain their original pins. [Exact source/parent proofs, per-branch patches/input manifests, build and CTest logs/JUnit, library/executable hashes and scoped CMake recipe](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-libc11-main9ab-linux-20261104.tar.gz), SHA-256 `97a2377bc996be1690e8853e1ea090a98b5ed808bcc37a15a5cdada5c2e00845` (download verified). AI-assisted: yes (Codex). **Review follow-up — `7e375f18d465586d4e50d2893d4d2a9a840702e2`.** Restored main's float-trig debt wording: the existing `TrigfKernelRemPio2` remains a separate one-word/precision-0 port, not shared with the new double reduction. Moved `tan_nid_postfix` and its complete s_tan.c notice together above the e_sinh.c notice, which again directly precedes `sinh_nid_postfix`. Trimmed the four notice-line trailing spaces. Executable tokens are unchanged except for the order of the tan definition; notice wording is retained. Linux x86-64/GCC16.2.1 Release: rebuilt actual libc, `guest_math_tests`, and `guest_math_exact_tests`; both test groups pass three repetitions each (**6 passes, zero skips**). Conventions and `git diff --check 4f41f4c375f` pass. No new Windows, console, title or performance run is claimed. [Review-fix patch, logs and source hashes](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/libc10253-notice-debt-7e375f18-20261103.tar.gz), SHA-256 `4ce442ee8617e329d8e5f1e6c36e628e65e921bf84421dcc4c15e50c88da1f2b` (GitHub asset digest verified). **Current-main integration — 2026-11-03.** Head `af6e9e83fa50bfe3bff146f2560120f11b9f1d0a` includes main `4f41f4c375f5abb487dbd184fbc150f31994d762` and retains the prior public history and attribution/licence notices. Main’s newer math implementations and fixtures remain alongside this topic. Main’s float argument-reduction tables, helper and `TrigfRemPio2` remain byte-identical and separate from the retained topic double-trig implementation. Actual open prerequisite #10250 head `5c054e6b5e48aef1bde87b7f6c31b70a9e00d563` is an ancestor. Linux x86-64 Release, GCC 16.2.1, Ninja, BUILD_TESTING=ON: rebuilt actual libc and math executables. `guest_math`, `guest_math_exact`, and `guest_dinkumware_internals` each pass 3/3 (**9 passes, zero skips**); `public_headers` and conventions pass. The same three groups pass 3/3 plus headers on pinned main. All 34 recursive dependency trees and 31,551 tracked blobs verify with zero errors; the update=none QuickJS test262 corpus is excluded from these library inputs. The four notice-line trailing spaces from this integration are removed in the follow-up below; no claim that main uses them remains. Source/parent/gitlink proofs, exact library/test hashes, raw logs/JUnit, and head-leased push receipts: [qualification archive](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/math15-main4f41-linux-20261103.tar.gz), SHA-256 `e6a50522bc28e30871fdc2c12a88d2537515914239e8166f6237f48895126a06` (download verified). Older platform/reference reports retain their original pins; no new Windows/macOS, SDK-module, console, title/GPU or performance claim. AI-assisted: yes (Codex). Earlier dated qualifications below retain their recorded source/platform pins. **Current-main integration (2026-11-02):** `2181a5edab48e035145cff5825c79240a87e8181` includes main `a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8` and retains the existing public commits. Conflicts preserve main’s math implementations, regression checks and debt entries alongside this topic. Linux x86-64 Release, GCC 16.2.1: rebuilt libc and the three math executables; `guest_math`, `guest_math_exact` and `guest_dinkumware_internals` each pass three times (9 passes, zero skips), and `public_headers` passes. The same baseline groups pass on main; conventions and whitespace pass. Source and dependency blobs, executable/library hashes, raw logs and JUnit are retained. This refresh adds no new console, Windows, title, GPU or numerical-reference measurement. [Qualification evidence](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/math-root14-maina4eca-linux-20261102-terminal.tar.gz), SHA-256 `22866bd2a060ba69cd4387d471605afe20ed644e3257174b2d1488635f8c9b52` (download verified). The current prerequisite #10250 head `5c054e6b5e48aef1bde87b7f6c31b70a9e00d563` is an ancestor of refreshed head `af6e9e83fa50bfe3bff146f2560120f11b9f1d0a`. <!-- codex-main-refresh-20261027-1018-pr10253 --> **Main conflict refresh, 2026-10-27 10:18 UTC pass:** exact head `57b6d204b0f7856c66cd6b997330c02dc9e5b83e` on tested main `3fea2a937ba9fbab2f06c51691fe0c5763659aa3`. The topic implementations and fixtures are retained alongside current main's newer math functions and coverage. Linux Release focused rebuild: `guest_math` and `guest_math_exact` each pass three repetitions: 6 passes, zero skips. Conventions, whitespace and merge checks pass. Every refreshed head's submodule pointers match the pinned main; the private dependency checkouts used for the gates are aligned. No new negative-control, Windows, console, title, GPU, full-suite or performance run is claimed. Earlier measurements below retain their original exact pins. Fulfilled merge-order dependencies have been cleared from the checklist; open prerequisites remain. [Exact source/dependency pins, patch-preservation and gitlink proofs, builds, verbose tests, JUnit and lease-push receipts](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-cpu11-main3fea-linux-20261027-1018.tar.gz). SHA-256: `702c4110ee9dde421c2dd5e057ed53a2df05e0cf7b01f67e8fb9cb779e332f7c`; downloaded copy verified. Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release, `BUILD_TESTING=ON`, `main` 4be3da2c6f. - **Comparison:** a scratch loader runs the decrypted `libc.prx` of PPSA07923, PPSA05916 and PPSA13934 natively and supplies `__error`. It compared their `asin` and `acos` with this PR's code, checking result bits (NaN payloads included) and `errno`, on: - 16 million random arguments per title (half random bit patterns, half with exponents 2^-63 to 2^0); - 64,303 structured arguments: the 6,001 floats around ±1, ±0.5, ±0.975, ±2^-26 and ±2^-57; both sides of each high-word edge with three low words; every power of two from 2^-1074 to 2^1023, both signs; and the special values. Results: - PPSA07923 and PPSA05916: identical bits and `errno` on all of them. - PPSA13934: identical `errno`. The bits differ on 5,576 `asin` and 1,823 `acos` arguments, because that copy is an FMA-contracted build. - **`errno` rule:** the console sets `EDOM` on exactly the arguments outside [-1, 1]. - **`guest_math`:** the new `CheckAsinConsoleBits` has 25 arguments, each with the console's `asin` and `acos` and its `errno`: - ±0, the 2^-57 and 2^-26 edges; - both sides of 0.5 and 0.975, the float below 1, and ±1; - the float above 1, 2 and ±`inf`; - NaN payloads of both signs; - three arguments per function where UCRT differs. `main`'s existing `asin` checks still pass, except one. The check from #3605 that `asin(2.0)` leaves `errno` at 0 now expects `EDOM`, because both PPSA07923's and PPSA05916's `asin(2.0)` set it (and every other argument outside [-1, 1] does too). Its `FE_INVALID` checks, raised for 2.0 and not for a quiet NaN, are unchanged and pass. cc @CouchRiv: the NaN bits and flags from #3605 are kept; only the `errno` follows the console instead of FreeBSD's source. `guest_math` and `guest_dinkumware_internals` pass in three runs out of three on the exact head. - **Negative control:** with `main`'s `Math.cpp` and these tests, `guest_math` aborts in a `Require`, while `guest_dinkumware_internals` still passes. - `python tools/check_conventions.py --base origin/main` and `git diff --check` pass. - **Overlap and order:** #9771 (`asinf`), #10222, #10229, #10234, #10245, #10247 and #10250, all mine, replace one-line host wrappers near `asin`'s and `acos`'s or add tests and debt entries at the same anchors, so they conflict textually. This PR lands last: #9777 → #9784 → #10222 → #9850 → #10229 → #10234 → #10245 → #10247 → #10250 → #10253 → the `pow` PR, with #10226 after #10222, #9857 before #10250 and #9771 before #10253. A combined preview of all twelve heads (`5d16b438db`, including #9857 and #9771) resolves every conflict by keeping each port and dropping each host wrapper. Each ported function is defined once and each console test is called once, and `guest_math` and `guest_dinkumware_internals` pass in three runs out of three on it. - **Not tested:** Linux and macOS (the result no longer depends on the host's functions), a console, the floating-point exception flags, and `asinl`/`acosl`. <!-- codex-math-refresh-20261028-repeat-pr10253 --> ### Current Linux qualification (2026-10-28) Rebased onto `main` `2227f1366188cda5699dd20e2e756a18006a5d4b`. Linux CPU validation on 2026-10-28 at `5b96a875888056c5bd758270593be17d1a3f5542` (Arch Linux 7.2.9, AMD Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON). `libc`, `guest_math_tests` and `guest_math_exact_tests` rebuilt from this exact source. `guest_math` and `guest_math_exact` each passed three consecutive runs (6/6, no skips); the same two suites each passed three runs on the pinned main (6/6). Conventions and whitespace checks pass. [Exact source pins, preservation proofs, dependency checks, build logs and JUnit](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-math25-main2227-linux-20261028-repeat.tar.gz), SHA-256 `1176269c9e6948b5252a5db9e660978d7f978fb2d9f4ed6c68bc050b10b5ae68`. This is focused Linux CPU qualification; earlier Windows/title/reference measurements retain their original pins. No new title or performance result is claimed. <!-- codex-maintenance-20261029-repeat-10253 --> **Current Linux qualification — 2026-10-29** Refreshed against main `5454cd2e455994d992aca39335ce60507eeda1eb`. Linux qualification at `ec98fb890ddb084b3a597798521e2c24260fb344` (Arch Linux 7.2.9, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON): `guest_math`, `guest_math_exact`, `guest_dinkumware_internals` each pass three consecutive runs (9/9, no skips). The `public_headers` audit passes at this exact head. All tracked public-header files match the pinned main; the affected test targets rebuild against those headers. Conventions and whitespace checks pass. The same focused groups passed three times on the pinned main. Evidence: [immutable Linux qualification bundle](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-math10-main5454-linux-20261029-repeat.tar.gz). Its SHA-256 is `53b095da2f67f55b8aa56ba273681e0330fb39739be844458038dde410fb8cc4`. No fresh Windows runtime execution is claimed; older measurements retain their recorded source pins. AI-assisted: yes (Codex). ### Checklist - [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: none; the msun functions are rewritten, as #9668, #5036 and the `sinhf` entry did - [x] Generic behaviour, not specific to one title - [x] Depends on: #10250 (actual refreshed head `5c054e6b5e48aef1bde87b7f6c31b70a9e00d563`) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
harisibrar1 commented 2026-10-24 12:47:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T12:47:40Z.

Review: APPROVED


Checked against main 39a36bbec8 and FreeBSD release/11.4.0 lib/msun/src/e_asin.c and e_acos.c:

  • It merges cleanly into current main, and main's asin/acos (Math.cpp:359-366) haven't changed since your base.
  • I compared both functions line by line with e_asin.c and e_acos.c. The branches, the cutoffs (0x3e500000, 0x3c600000, 0x3FEF3333), the low-word sqrt split and acos's volatile pio2_lo all match, and AsinRational is exactly msun's p/q.
  • All the constants match the source literals, and each one round-trips to the hex in msun's comments.
  • I ran a separate Python transcription of the two FreeBSD files on all 19 finite cases in CheckAsinConsoleBits. It gives the expected asin and acos bits for every one, including the three UCRT-differing arguments. So the expectations agree with the cited source, not only with the port.
  • Small note: this PR and #10247 both add their test function and call at the same place in GuestMath.cpp (just before CheckExpm1ConsoleBits), so they conflict textually and whichever lands second needs a trivial rebase. You've already listed the order.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638288261 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10253#pullrequestreview-5638288261). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-24T12:47:40Z. **Review:** APPROVED --- Checked against main 39a36bbec8 and FreeBSD release/11.4.0 lib/msun/src/e_asin.c and e_acos.c: - It merges cleanly into current main, and main's `asin`/`acos` (Math.cpp:359-366) haven't changed since your base. - I compared both functions line by line with e_asin.c and e_acos.c. The branches, the cutoffs (0x3e500000, 0x3c600000, 0x3FEF3333), the low-word `sqrt` split and acos's volatile `pio2_lo` all match, and `AsinRational` is exactly msun's `p/q`. - All the constants match the source literals, and each one round-trips to the hex in msun's comments. - I ran a separate Python transcription of the two FreeBSD files on all 19 finite cases in `CheckAsinConsoleBits`. It gives the expected asin and acos bits for every one, including the three UCRT-differing arguments. So the expectations agree with the cited source, not only with the port. - Small note: this PR and #10247 both add their test function and call at the same place in GuestMath.cpp (just before `CheckExpm1ConsoleBits`), so they conflict textually and whichever lands second needs a trivial rebase. You've already listed the order. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
XairRrR commented 2026-11-03 09:15:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T09:15:17Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

This pull request does not merge cleanly into main (4f41f4c375): head 096332ca54 conflicts in

  • core/libs/tests/GuestMath.cpp

Please rebase it onto current main. I will review the change once it merges cleanly.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5749586825 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10253#pullrequestreview-5749586825). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T09:15:17Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested This pull request does not merge cleanly into `main` (4f41f4c375f5abb487dbd184fbc150f31994d762): head 096332ca54494f32f06d6f5df25e1ab106ba49e0 conflicts in - `core/libs/tests/GuestMath.cpp` Please rebase it onto current `main`. I will review the change once it merges cleanly. <!-- anyps5-bots job=2161 head=096332ca54494f32f06d6f5df25e1ab106ba49e0 -->
XairRrR commented 2026-11-03 14:21:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T14:21:47Z.

Review: CHANGES_REQUESTED


Re-checked — changes still requested

The new commits (f7a1526101cb…af6e9e83fa50) bring in current main and #10250's head, and they add msun source and licence notices. The conflict is gone, but the sinf/cosf/tanf debt entry now claims a k_rem_pio2.c port that the code does not share.

What changed since my last review

The text of my previous review is not available to me, so I reviewed the whole change again. According to the author's last comment, that review asked for a conflict with current main to be resolved. Since then:

  • The author merged main 4f41f4c375f5 and #10250's head 5c054e6b5e48, which is an ancestor of this head.
  • IL2P added the e_asin.c, e_acos.c and trig source and licence notices (3c88fb4e8ca8, 096332ca5449).
  • 5c054e6b5e48 keeps main's float argument reduction (TrigfIpio2, TrigfKernelRemPio2, TrigfRemPio2) apart from the double KernelRemPio2.
  • The description has a new 2026-11-03 qualification paragraph.

What I ran

Head af6e9e83fa50bfe3bff146f2560120f11b9f1d0a, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree 134c2613b7dea84a648bd57658eb5b41b8344220. The worktree was already built (Release, GCC 14.2.0, Ninja, BUILD_TESTING=ON) on Debian 13, 32 vCPU Xeon Gold 6136.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...af6e9e83fa50bfe3bff146f2560120f11b9f1d0a
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build --output-on-failure -R "^(guest_math|guest_math_exact|guest_dinkumware_internals)$"
# negative control
git show 4f41f4c375f5abb487dbd184fbc150f31994d762:core/libs/prx/libc/src/Math.cpp > core/libs/prx/libc/src/Math.cpp
ninja -C build -j32 -l32 libc guest_math_tests
ctest --test-dir build --output-on-failure -R "^guest_math$"
git show 134c2613b7dea84a648bd57658eb5b41b8344220:core/libs/prx/libc/src/Math.cpp > core/libs/prx/libc/src/Math.cpp
ninja -C build -j32 -l32 libc guest_math_tests
ctest --test-dir build -R "^guest_math$"
git status --porcelain
Check Result
Merge into main Clean
Build, libs OK (build.json)
Selected tests (build.json) 0 new failures, 0 timeouts. 9 known failures, all failing on main too. guest_net_ctl skip is known on main
guest_math, guest_math_exact, guest_dinkumware_internals Pass
check_conventions.py Passed
git diff --check 4 trailing-space lines (exit 2)
Negative control guest_math aborts with main's Math.cpp
Worktree restored git status --porcelain empty, guest_math passes again
git diff --check
core/libs/prx/libc/src/Math.cpp:731: trailing whitespace.
+ * software is freely granted, provided that this notice 
core/libs/prx/libc/src/Math.cpp:1694: trailing whitespace.
core/libs/prx/libc/src/Math.cpp:1803: trailing whitespace.
core/libs/prx/libc/src/Math.cpp:1831: trailing whitespace.
Negative control
1/1 Test #769: guest_math .......................Subprocess aborted***Exception:   0.01 sec
../core/libs/tests/GuestMath.cpp:975: requirement failed

Line 975 is the asin bit check in CheckAsinConsoleBits.

Previous findings

  • Conflict with current main — Resolved. The head merges cleanly into 4f41f4c375f5 with --no-ff, it builds, and the focused tests pass.

New findings

Blocking

  1. The sinf/cosf/tanf debt entry contradicts the code (docs/dev/debt/libc.md:160).
    • The entry now says k_rem_pio2.c is "shared with sin, cos and tan".
    • After 5c054e6b5e48, the float functions still use their own one-word, prec 0 TrigfKernelRemPio2 (Math.cpp:1415, called at L1549).
    • Only RemPio2 calls the new KernelRemPio2(…, nx, 1) (L1785).
    • main's wording ("ported only for one input word and prec 0") is still the accurate one, and debt entries have to describe what the code does.
    • Fix, either:
      • restore main's sentence for that entry; or
      • make the float path really call KernelRemPio2(tx, ty, e0, 1, 0) and remove TrigfIpio2/TrigfKernelRemPio2.

Non-blocking

  1. The s_tan.c port is placed inside the sinh attribution (Math.cpp:2008-2020).
    • The SunSoft notice and the "Adapted from … e_sinh.c" line are now followed by the s_tan.c notice and tan_nid_postfix, not by sinh_nid_postfix.
    • A reader therefore sees e_sinh.c credited for tan, and sinh loses its notice.
    • Fix: move the s_tan.c block (notice plus tan_nid_postfix) above line 2008, for example right after cos_nid_postfix.
  2. The table and kernel for k_rem_pio2.c now exist twice. RemPio2Ipio2 (L1269) and TrigfIpio2 (L1401) are the same 66-entry table, and KernelRemPio2 generalises TrigfKernelRemPio2. This is fine for now, but it is the duplication that blocking finding 1's second option would remove.
  3. The trailing whitespace claim in the description is not right.
    • git diff --check fails on four notice lines (731, 1694, 1803, 1831).
    • The 2026-11-03 comment says main keeps such trailing spaces for the other SunSoft notices in this file. On 4f41f4c375f5, no line of Math.cpp ends in this notice with a trailing space.
    • The PR is also inconsistent: the e_asin.c notice it adds has no trailing space, while e_acos.c's has one.
    • I cannot check the FreeBSD sources offline. If the spaces are verbatim, say so precisely; otherwise trim them.

asin/acos code review (whole change):

  • I compared asin_nid_postfix and acos_nid_postfix branch by branch with msun 11.4 e_asin.c/e_acos.c: thresholds, the low-word sqrt split, the pS/qS rational and acos's volatile pio2_lo. They match.
  • The sin/cos/tan kernels and RemPio2/KernelRemPio2 also match msun's structure.
  • libc builds with -ffp-contract=off, so the bit expectations do not depend on contraction.
  • This confirms harisibrar1's line-by-line check, and adds that it still holds at this head.
  • The errno/FE_INVALID change to CheckAsin follows the titles' libc.prx, as the author reports, and it is covered by the debt entry.

Not verified

  • The console and title libc.prx comparisons (16M/64,303 arguments, 320M trig arguments) and the Windows runs are author-reported. I did not reproduce them.
  • The FreeBSD notice text, including whether the trailing spaces are verbatim: no network.
  • Windows and macOS builds.
  • No Vulkan validation comparison was needed: the change touches no AGC, shader or VideoOut files.

To get this to a good state

  1. Make the sinf, cosf, tanf and sincosf debt entry match the code: restore main's wording, or really share KernelRemPio2.
  2. Move tan_nid_postfix and its s_tan.c notice out from between e_sinh.c's notice and sinh_nid_postfix.
  3. Correct or trim the trailing-space notice lines, and fix the description's claim about main.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5753782735 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10253#pullrequestreview-5753782735). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T14:21:47Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes still requested The new commits (`f7a1526101cb`…`af6e9e83fa50`) bring in current `main` and #10250's head, and they add msun source and licence notices. The conflict is gone, but the `sinf`/`cosf`/`tanf` debt entry now claims a `k_rem_pio2.c` port that the code does not share. ## What changed since my last review The text of my previous review is not available to me, so I reviewed the whole change again. According to the author's last comment, that review asked for a conflict with current `main` to be resolved. Since then: - The author merged `main` `4f41f4c375f5` and #10250's head `5c054e6b5e48`, which is an ancestor of this head. - IL2P added the e_asin.c, e_acos.c and trig source and licence notices (`3c88fb4e8ca8`, `096332ca5449`). - `5c054e6b5e48` keeps `main`'s float argument reduction (`TrigfIpio2`, `TrigfKernelRemPio2`, `TrigfRemPio2`) apart from the double `KernelRemPio2`. - The description has a new 2026-11-03 qualification paragraph. ## What I ran Head `af6e9e83fa50bfe3bff146f2560120f11b9f1d0a`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `134c2613b7dea84a648bd57658eb5b41b8344220`. The worktree was already built (Release, GCC 14.2.0, Ninja, BUILD_TESTING=ON) on Debian 13, 32 vCPU Xeon Gold 6136. ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...af6e9e83fa50bfe3bff146f2560120f11b9f1d0a python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build --output-on-failure -R "^(guest_math|guest_math_exact|guest_dinkumware_internals)$" # negative control git show 4f41f4c375f5abb487dbd184fbc150f31994d762:core/libs/prx/libc/src/Math.cpp > core/libs/prx/libc/src/Math.cpp ninja -C build -j32 -l32 libc guest_math_tests ctest --test-dir build --output-on-failure -R "^guest_math$" git show 134c2613b7dea84a648bd57658eb5b41b8344220:core/libs/prx/libc/src/Math.cpp > core/libs/prx/libc/src/Math.cpp ninja -C build -j32 -l32 libc guest_math_tests ctest --test-dir build -R "^guest_math$" git status --porcelain ``` | Check | Result | |---|---| | Merge into `main` | Clean | | Build, `libs` | OK (build.json) | | Selected tests (build.json) | 0 new failures, 0 timeouts. 9 known failures, all failing on `main` too. `guest_net_ctl` skip is known on `main` | | `guest_math`, `guest_math_exact`, `guest_dinkumware_internals` | Pass | | `check_conventions.py` | Passed | | `git diff --check` | 4 trailing-space lines (exit 2) | | Negative control | `guest_math` aborts with `main`'s `Math.cpp` | | Worktree restored | `git status --porcelain` empty, `guest_math` passes again | <details><summary>git diff --check</summary> ``` core/libs/prx/libc/src/Math.cpp:731: trailing whitespace. + * software is freely granted, provided that this notice core/libs/prx/libc/src/Math.cpp:1694: trailing whitespace. core/libs/prx/libc/src/Math.cpp:1803: trailing whitespace. core/libs/prx/libc/src/Math.cpp:1831: trailing whitespace. ``` </details> <details><summary>Negative control</summary> ``` 1/1 Test #769: guest_math .......................Subprocess aborted***Exception: 0.01 sec ../core/libs/tests/GuestMath.cpp:975: requirement failed ``` Line 975 is the `asin` bit check in `CheckAsinConsoleBits`. </details> ## Previous findings - **Conflict with current `main` — Resolved.** The head merges cleanly into `4f41f4c375f5` with `--no-ff`, it builds, and the focused tests pass. ## New findings ### Blocking 1. **The `sinf`/`cosf`/`tanf` debt entry contradicts the code** ([docs/dev/debt/libc.md:160](https://github.com/boykopovar/AnyPS5/blob/af6e9e83fa50bfe3bff146f2560120f11b9f1d0a/docs/dev/debt/libc.md#L160)). - The entry now says `k_rem_pio2.c` is "shared with `sin`, `cos` and `tan`". - After `5c054e6b5e48`, the float functions still use their own one-word, `prec` 0 `TrigfKernelRemPio2` ([Math.cpp:1415](https://github.com/boykopovar/AnyPS5/blob/af6e9e83fa50bfe3bff146f2560120f11b9f1d0a/core/libs/prx/libc/src/Math.cpp#L1415), called at [L1549](https://github.com/boykopovar/AnyPS5/blob/af6e9e83fa50bfe3bff146f2560120f11b9f1d0a/core/libs/prx/libc/src/Math.cpp#L1549)). - Only `RemPio2` calls the new `KernelRemPio2(…, nx, 1)` ([L1785](https://github.com/boykopovar/AnyPS5/blob/af6e9e83fa50bfe3bff146f2560120f11b9f1d0a/core/libs/prx/libc/src/Math.cpp#L1785)). - `main`'s wording ("ported only for one input word and `prec` 0") is still the accurate one, and debt entries have to describe what the code does. - Fix, either: - restore `main`'s sentence for that entry; or - make the float path really call `KernelRemPio2(tx, ty, e0, 1, 0)` and remove `TrigfIpio2`/`TrigfKernelRemPio2`. ### Non-blocking 1. **The s_tan.c port is placed inside the sinh attribution** ([Math.cpp:2008-2020](https://github.com/boykopovar/AnyPS5/blob/af6e9e83fa50bfe3bff146f2560120f11b9f1d0a/core/libs/prx/libc/src/Math.cpp#L2008-L2020)). - The SunSoft notice and the "Adapted from … e_sinh.c" line are now followed by the s_tan.c notice and `tan_nid_postfix`, not by `sinh_nid_postfix`. - A reader therefore sees e_sinh.c credited for `tan`, and `sinh` loses its notice. - Fix: move the s_tan.c block (notice plus `tan_nid_postfix`) above line 2008, for example right after `cos_nid_postfix`. 2. **The table and kernel for `k_rem_pio2.c` now exist twice.** `RemPio2Ipio2` (L1269) and `TrigfIpio2` (L1401) are the same 66-entry table, and `KernelRemPio2` generalises `TrigfKernelRemPio2`. This is fine for now, but it is the duplication that blocking finding 1's second option would remove. 3. **The trailing whitespace claim in the description is not right.** - `git diff --check` fails on four notice lines (731, 1694, 1803, 1831). - The 2026-11-03 comment says `main` keeps such trailing spaces for the other SunSoft notices in this file. On `4f41f4c375f5`, no line of `Math.cpp` ends in `this notice ` with a trailing space. - The PR is also inconsistent: the e_asin.c notice it adds has no trailing space, while e_acos.c's has one. - I cannot check the FreeBSD sources offline. If the spaces are verbatim, say so precisely; otherwise trim them. asin/acos code review (whole change): - I compared `asin_nid_postfix` and `acos_nid_postfix` branch by branch with msun 11.4 e_asin.c/e_acos.c: thresholds, the low-word `sqrt` split, the `pS`/`qS` rational and acos's volatile `pio2_lo`. They match. - The sin/cos/tan kernels and `RemPio2`/`KernelRemPio2` also match msun's structure. - libc builds with `-ffp-contract=off`, so the bit expectations do not depend on contraction. - This confirms harisibrar1's line-by-line check, and adds that it still holds at this head. - The `errno`/`FE_INVALID` change to `CheckAsin` follows the titles' `libc.prx`, as the author reports, and it is covered by the debt entry. ## Not verified - The console and title `libc.prx` comparisons (16M/64,303 arguments, 320M trig arguments) and the Windows runs are author-reported. I did not reproduce them. - The FreeBSD notice text, including whether the trailing spaces are verbatim: no network. - Windows and macOS builds. - No Vulkan validation comparison was needed: the change touches no AGC, shader or VideoOut files. ## To get this to a good state 1. Make the `sinf, cosf, tanf and sincosf` debt entry match the code: restore `main`'s wording, or really share `KernelRemPio2`. 2. Move `tan_nid_postfix` and its s_tan.c notice out from between e_sinh.c's notice and `sinh_nid_postfix`. 3. Correct or trim the trailing-space notice lines, and fix the description's claim about `main`. <!-- anyps5-bots job=3357 head=af6e9e83fa50bfe3bff146f2560120f11b9f1d0a -->
XairRrR commented 2026-11-03 15:22:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T15:22:16Z.

Review: APPROVED


Re-checked — approved

Commit 7e375f18d465 fixes all three of my earlier requests: it restores main's sinf/cosf/tanf debt wording, moves the s_tan.c notice and tan back above e_sinh.c's notice, and trims the four trailing spaces in the notices. The checks, the focused tests and the negative control all pass.

What changed since my last review

  • There is one new commit, 7e375f18d465, on top of af6e9e83fa50. The range-diff shows commits 1–7 unchanged. The new commit changes only Math.cpp (notice lines and the order of tan) and docs/dev/debt/libc.md.
  • In Math.cpp the only code change is the position of tan_nid_postfix. The tokens of the function itself are unchanged.
  • The description and a 2026-11-03 comment explain these changes. The comment no longer says that main keeps trailing spaces in its notices.

What I ran

Head 7e375f18d465586d4e50d2893d4d2a9a840702e2, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree 0542f4a6156d2c2a1533e9c1d741e1f7ea843454. Release build with GCC 14.2.0 and Ninja, on Debian 13 (32 vCPU Xeon Gold 6136).

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...7e375f18d465586d4e50d2893d4d2a9a840702e2
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
git diff af6e9e83fa50bfe3bff146f2560120f11b9f1d0a 7e375f18d465586d4e50d2893d4d2a9a840702e2
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "^(guest_math|guest_math_exact|guest_dinkumware_internals|public_headers)$"
# negative control
git show 4f41f4c375f5abb487dbd184fbc150f31994d762:core/libs/prx/libc/src/Math.cpp > core/libs/prx/libc/src/Math.cpp
ninja -C build -j32 -l32 libc guest_math_tests
ctest --test-dir build --output-on-failure -R "^guest_math$"
git show 0542f4a6156d2c2a1533e9c1d741e1f7ea843454:core/libs/prx/libc/src/Math.cpp > core/libs/prx/libc/src/Math.cpp
ninja -C build -j32 -l32 libc guest_math_tests
ctest --test-dir build -R "^guest_math$"
git status --porcelain
Check Result
Merge into main Clean
Build, libs (build.json) OK
Selected tests (build.json) 0 new failures, 0 timeouts. 9 known failures, which also fail on main. The guest_net_ctl skip is known on main
git diff --check Clean (exit 0)
check_conventions.py Passed
guest_math, guest_math_exact, guest_dinkumware_internals, public_headers 4/4 pass
Negative control guest_math aborts (Subprocess aborted) with main's Math.cpp
Restore Rebuilt, guest_math passes, git status --porcelain is empty

Previous findings

  • Blocking — the sinf/cosf/tanf debt entry contradicted the code: Resolved. docs/dev/debt/libc.md:160 again says "ported only for one input word and prec 0". The merged diff against main no longer changes that line. This matches the separate TrigfKernelRemPio2.
  • Non-blocking — the s_tan.c port sat inside the sinh attribution: Resolved. The s_tan.c line and its notice now come before tan_nid_postfix (Math.cpp:2008–2034). The SunSoft notice and the e_sinh.c line now come directly before sinh_nid_postfix (Math.cpp:2038-2050).
  • Non-blocking — the k_rem_pio2.c table and kernel exist twice (RemPio2Ipio2/KernelRemPio2 and TrigfIpio2/TrigfKernelRemPio2): Still open. The author deliberately keeps the float reduction separate, and the debt entry now says so. This is not a blocker.
  • Non-blocking — trailing spaces and the description's claim about main: Resolved. git diff --check is clean, and the description and comment no longer make the claim.

New findings

Blocking

None.

Non-blocking

None.

Not verified

  • The comparisons against console and title libc.prx copies (asin/acos: 16 million random and 64,303 structured arguments; trig: 320 million) and the Windows runs are reported by the author. I did not reproduce them.
  • I could not check the FreeBSD notice text against upstream because this machine has no network.
  • I did not build on Windows or macOS.
  • I did not run the Vulkan validation comparison: the change touches no AGC, shader or VideoOut files.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5754799647 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10253#pullrequestreview-5754799647). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T15:22:16Z. **Review:** APPROVED --- # Re-checked — approved Commit `7e375f18d465` fixes all three of my earlier requests: it restores `main`'s `sinf`/`cosf`/`tanf` debt wording, moves the s_tan.c notice and `tan` back above e_sinh.c's notice, and trims the four trailing spaces in the notices. The checks, the focused tests and the negative control all pass. ## What changed since my last review - There is one new commit, `7e375f18d465`, on top of `af6e9e83fa50`. The range-diff shows commits 1–7 unchanged. The new commit changes only `Math.cpp` (notice lines and the order of `tan`) and `docs/dev/debt/libc.md`. - In `Math.cpp` the only code change is the position of `tan_nid_postfix`. The tokens of the function itself are unchanged. - The description and a 2026-11-03 comment explain these changes. The comment no longer says that `main` keeps trailing spaces in its notices. ## What I ran Head `7e375f18d465586d4e50d2893d4d2a9a840702e2`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `0542f4a6156d2c2a1533e9c1d741e1f7ea843454`. Release build with GCC 14.2.0 and Ninja, on Debian 13 (32 vCPU Xeon Gold 6136). ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...7e375f18d465586d4e50d2893d4d2a9a840702e2 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 git diff af6e9e83fa50bfe3bff146f2560120f11b9f1d0a 7e375f18d465586d4e50d2893d4d2a9a840702e2 ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "^(guest_math|guest_math_exact|guest_dinkumware_internals|public_headers)$" # negative control git show 4f41f4c375f5abb487dbd184fbc150f31994d762:core/libs/prx/libc/src/Math.cpp > core/libs/prx/libc/src/Math.cpp ninja -C build -j32 -l32 libc guest_math_tests ctest --test-dir build --output-on-failure -R "^guest_math$" git show 0542f4a6156d2c2a1533e9c1d741e1f7ea843454:core/libs/prx/libc/src/Math.cpp > core/libs/prx/libc/src/Math.cpp ninja -C build -j32 -l32 libc guest_math_tests ctest --test-dir build -R "^guest_math$" git status --porcelain ``` | Check | Result | |---|---| | Merge into `main` | Clean | | Build, `libs` (build.json) | OK | | Selected tests (build.json) | 0 new failures, 0 timeouts. 9 known failures, which also fail on `main`. The `guest_net_ctl` skip is known on `main` | | `git diff --check` | Clean (exit 0) | | `check_conventions.py` | Passed | | `guest_math`, `guest_math_exact`, `guest_dinkumware_internals`, `public_headers` | 4/4 pass | | Negative control | `guest_math` aborts (Subprocess aborted) with `main`'s `Math.cpp` | | Restore | Rebuilt, `guest_math` passes, `git status --porcelain` is empty | ## Previous findings - **Blocking — the `sinf`/`cosf`/`tanf` debt entry contradicted the code: Resolved.** [docs/dev/debt/libc.md:160](https://github.com/boykopovar/AnyPS5/blob/7e375f18d465586d4e50d2893d4d2a9a840702e2/docs/dev/debt/libc.md#L160) again says "ported only for one input word and `prec` 0". The merged diff against `main` no longer changes that line. This matches the separate `TrigfKernelRemPio2`. - **Non-blocking — the s_tan.c port sat inside the sinh attribution: Resolved.** The s_tan.c line and its notice now come before `tan_nid_postfix` (Math.cpp:2008–2034). The SunSoft notice and the e_sinh.c line now come directly before `sinh_nid_postfix` ([Math.cpp:2038-2050](https://github.com/boykopovar/AnyPS5/blob/7e375f18d465586d4e50d2893d4d2a9a840702e2/core/libs/prx/libc/src/Math.cpp#L2038-L2050)). - **Non-blocking — the `k_rem_pio2.c` table and kernel exist twice (`RemPio2Ipio2`/`KernelRemPio2` and `TrigfIpio2`/`TrigfKernelRemPio2`): Still open.** The author deliberately keeps the float reduction separate, and the debt entry now says so. This is not a blocker. - **Non-blocking — trailing spaces and the description's claim about `main`: Resolved.** `git diff --check` is clean, and the description and comment no longer make the claim. ## New findings ### Blocking None. ### Non-blocking None. ## Not verified - The comparisons against console and title `libc.prx` copies (asin/acos: 16 million random and 64,303 structured arguments; trig: 320 million) and the Windows runs are reported by the author. I did not reproduce them. - I could not check the FreeBSD notice text against upstream because this machine has no network. - I did not build on Windows or macOS. - I did not run the Vulkan validation comparison: the change touches no AGC, shader or VideoOut files. <!-- anyps5-bots job=3408 head=7e375f18d465586d4e50d2893d4d2a9a840702e2 -->
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!10253
No description provided.