feat(libc): implement j0, j1, jn, y0, y1 and yn #7998

Merged
priyanshrv-netizen merged 1 commit from upstream-pr/7998 into main 2026-10-20 04:50:11 +00:00
priyanshrv-netizen commented 2026-10-19 17:14:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by priyanshrv-netizen on 2026-10-19T17:14:52Z.


What

Implements six libc exports that no source in core/libs/prx declared yet: the double Bessel functions j0, j1, jn, y0, y1 and yn (NIDs tcN0ngcXegg, BNbWdC9Jg+4, QdE7Arjzxos, RvsFE8j3C38, vh9aGR3ALP0, eWSt5lscApo). I found them by diffing the export table of a system libc.prx (build J03093718) against the NIDs declared in the tree and in every open pull request. The float versions (j0f … ynf) already exist and are unchanged.

core/libs/prx/libc/src/Bessel.cpp follows that module's disassembly (0x51D60, 0x52B10, 0x53850, 0x520E0, 0x52E50, 0x53CA0). It is FreeBSD msun's e_j0.c, e_j1.c and e_jn.c built with FMA contraction, and every constant and all 32 pzero/qzero/pone/qone tables match the binary:

  • Each multiply-add the console fuses (vfmadd/vfmsub) is one FMA here, and the unfused ones stay unfused. The FMA is the instruction when __builtin_cpu_supports("fma"), otherwise std::fma. Square roots use sqrtsd. This guards against runtimes whose fma or sqrt is not correctly rounded. I hit that with the MSYS2 mingw64 (msvcrt) runtime: std::fma differed from vfmadd in 9% of 10 million cancellation cases, and at -O0 std::sqrt differed from sqrtsd in 1,313 of 5 million arguments. The WinLibs UCRT toolchain from BUILD.md does not have the problem (measured in review), so on supported toolchains this changes nothing.
  • y0, y1 and yn return -inf for ±0 and the quiet NaN 0x7ff8000000000000 for negative arguments as constants, as the console does. They raise no exception, and none of the six sets errno.
  • jn and yn handle the order with the console's 32-bit wraparound, so n = INT_MIN, INT_MAX and 1 << 30 behave as they do there (the last one never returns, on the console too).

sin, cos, sincos and log are the host's, as for the other libc math functions, so the last bits can differ from the console. This is recorded in docs/dev/debt/libc.md, which also notes that the y-functions deliberately return the console's constants without exceptions, as msun did before FreeBSD commit 186f620727, and that the console's y0f/y1f/ynf raise none either (measured).

core/libs/tests/GuestBessel.cpp checks exact console bits on every path that does not go through sin/cos/log, including inputs where fused and unfused evaluation differ. It also checks special values, errno, the absence of FP exceptions for the y-functions, the order identities including INT_MIN, and agreement within 1e-12 with 60-digit mpmath values (it passes at 1e-14), without std::cyl_bessel_j/std::cyl_neumann, which libc++ lacks.

Tested

Windows 10, AMD Ryzen 5 4600H (Zen 2), MSYS2 MinGW-w64 GCC 15.2.0 (mingw64, not the WinLibs UCRT toolchain from BUILD.md). I did not configure the full CMake build. GuestBessel.cpp was compiled with Bessel.cpp and a stub __error_nid_postfix, at -O0 and -O2, and passes; Bessel.cpp builds with -Wall -Wextra -Werror. Each of six deliberate breaks (unfusing one multiply-add, a non-FMA Horner step, fusing an unfused step, reassociating -tpi/x, dropping the rescaled recurrence, losing a sign) makes the test fail.

Against the console code itself, I mapped the module's segments into executable memory, applied its relocations, and called its j0 … yn through System V function pointers. With this implementation using the console's own sin, cos, sincos and log, results matched in every bit, NaN payloads included, and in the invalid, divide-by-zero, overflow and underflow flags. That covered 90 million calls at -O2 and 18 million at -O0: special values, ±40 ulps around every branch threshold, random bit patterns, log-uniform and linear ranges, orders −40…40 and 64…4096, plus INT_MIN, INT_MAX, 2^30 and 2^30+1. With MinGW's own primitives, about 3% of arguments between 2 and 30 differ from the console, against 93% for MinGW's own j0/j1/y0/y1.

tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py --branch feat/libc-bessel reports no overlap. I checked by hand the 11 pull requests it could not compare (each conflicts with main): none adds these exports or edits nearby lines. Not tested on Linux; no title was run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4924639524 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7998). Originally posted by [priyanshrv-netizen](https://github.com/priyanshrv-netizen) on 2026-10-19T17:14:52Z. --- ### What Implements six libc exports that no source in `core/libs/prx` declared yet: the double Bessel functions `j0`, `j1`, `jn`, `y0`, `y1` and `yn` (NIDs `tcN0ngcXegg`, `BNbWdC9Jg+4`, `QdE7Arjzxos`, `RvsFE8j3C38`, `vh9aGR3ALP0`, `eWSt5lscApo`). I found them by diffing the export table of a system `libc.prx` (build `J03093718`) against the NIDs declared in the tree and in every open pull request. The float versions (`j0f` … `ynf`) already exist and are unchanged. `core/libs/prx/libc/src/Bessel.cpp` follows that module's disassembly (0x51D60, 0x52B10, 0x53850, 0x520E0, 0x52E50, 0x53CA0). It is FreeBSD msun's `e_j0.c`, `e_j1.c` and `e_jn.c` built with FMA contraction, and every constant and all 32 `pzero`/`qzero`/`pone`/`qone` tables match the binary: - Each multiply-add the console fuses (`vfmadd`/`vfmsub`) is one FMA here, and the unfused ones stay unfused. The FMA is the instruction when `__builtin_cpu_supports("fma")`, otherwise `std::fma`. Square roots use `sqrtsd`. This guards against runtimes whose `fma` or `sqrt` is not correctly rounded. I hit that with the MSYS2 `mingw64` (msvcrt) runtime: `std::fma` differed from `vfmadd` in 9% of 10 million cancellation cases, and at `-O0` `std::sqrt` differed from `sqrtsd` in 1,313 of 5 million arguments. The WinLibs UCRT toolchain from BUILD.md does not have the problem (measured in review), so on supported toolchains this changes nothing. - `y0`, `y1` and `yn` return `-inf` for ±0 and the quiet NaN `0x7ff8000000000000` for negative arguments as constants, as the console does. They raise no exception, and none of the six sets `errno`. - `jn` and `yn` handle the order with the console's 32-bit wraparound, so `n = INT_MIN`, `INT_MAX` and `1 << 30` behave as they do there (the last one never returns, on the console too). `sin`, `cos`, `sincos` and `log` are the host's, as for the other libc math functions, so the last bits can differ from the console. This is recorded in `docs/dev/debt/libc.md`, which also notes that the y-functions deliberately return the console's constants without exceptions, as msun did before FreeBSD commit `186f620727`, and that the console's `y0f`/`y1f`/`ynf` raise none either (measured). `core/libs/tests/GuestBessel.cpp` checks exact console bits on every path that does not go through `sin`/`cos`/`log`, including inputs where fused and unfused evaluation differ. It also checks special values, `errno`, the absence of FP exceptions for the y-functions, the order identities including `INT_MIN`, and agreement within 1e-12 with 60-digit mpmath values (it passes at 1e-14), without `std::cyl_bessel_j`/`std::cyl_neumann`, which libc++ lacks. ### Tested Windows 10, AMD Ryzen 5 4600H (Zen 2), MSYS2 MinGW-w64 GCC 15.2.0 (`mingw64`, not the WinLibs UCRT toolchain from BUILD.md). I did not configure the full CMake build. `GuestBessel.cpp` was compiled with `Bessel.cpp` and a stub `__error_nid_postfix`, at `-O0` and `-O2`, and passes; `Bessel.cpp` builds with `-Wall -Wextra -Werror`. Each of six deliberate breaks (unfusing one multiply-add, a non-FMA Horner step, fusing an unfused step, reassociating `-tpi/x`, dropping the rescaled recurrence, losing a sign) makes the test fail. Against the console code itself, I mapped the module's segments into executable memory, applied its relocations, and called its `j0` … `yn` through System V function pointers. With this implementation using the console's own `sin`, `cos`, `sincos` and `log`, results matched in every bit, NaN payloads included, and in the invalid, divide-by-zero, overflow and underflow flags. That covered 90 million calls at `-O2` and 18 million at `-O0`: special values, ±40 ulps around every branch threshold, random bit patterns, log-uniform and linear ranges, orders −40…40 and 64…4096, plus `INT_MIN`, `INT_MAX`, 2^30 and 2^30+1. With MinGW's own primitives, about 3% of arguments between 2 and 30 differ from the console, against 93% for MinGW's own `j0`/`j1`/`y0`/`y1`. `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py --branch feat/libc-bessel` reports no overlap. I checked by hand the 11 pull requests it could not compare (each conflicts with `main`): none adds these exports or edits nearby lines. Not tested on Linux; no title was run. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-19 17:33:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T17:33:38Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 5303 docs/dev/debt/libc.md
PR 6044 core/libs/prx/libc/CMakeLists.txt
PR 6226 docs/dev/debt/libc.md
PR 6469 docs/dev/debt/libc.md
PR 6819 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 7081 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 7201 core/libs/prx/libc/CMakeLists.txt
PR 7332 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 7386 docs/dev/debt/libc.md
PR 7473 docs/dev/debt/libc.md
PR 7715 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 8037 docs/dev/debt/libc.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6273269096 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7998#issuecomment-6273269096). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T17:33:38Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libc/CMakeLists.txt`<br>`docs/dev/debt/libc.md` | | [PR 5303](https://www.github.com/boykopovar/AnyPS5/pull/5303) | `docs/dev/debt/libc.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libc/CMakeLists.txt` | | [PR 6226](https://www.github.com/boykopovar/AnyPS5/pull/6226) | `docs/dev/debt/libc.md` | | [PR 6469](https://www.github.com/boykopovar/AnyPS5/pull/6469) | `docs/dev/debt/libc.md` | | [PR 6819](https://www.github.com/boykopovar/AnyPS5/pull/6819) | `core/libs/prx/libc/CMakeLists.txt`<br>`docs/dev/debt/libc.md` | | [PR 7081](https://www.github.com/boykopovar/AnyPS5/pull/7081) | `core/libs/prx/libc/CMakeLists.txt`<br>`docs/dev/debt/libc.md` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libc/CMakeLists.txt` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libc/CMakeLists.txt`<br>`docs/dev/debt/libc.md` | | [PR 7386](https://www.github.com/boykopovar/AnyPS5/pull/7386) | `docs/dev/debt/libc.md` | | [PR 7473](https://www.github.com/boykopovar/AnyPS5/pull/7473) | `docs/dev/debt/libc.md` | | [PR 7715](https://www.github.com/boykopovar/AnyPS5/pull/7715) | `core/libs/prx/libc/CMakeLists.txt`<br>`docs/dev/debt/libc.md` | | [PR 8037](https://www.github.com/boykopovar/AnyPS5/pull/8037) | `docs/dev/debt/libc.md` |
wachi35676 commented 2026-10-20 00:16:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-20T00:16:30Z.


Windows 11, Ryzen 5 9600X, WinLibs GCC 15.2.0 (UCRT, the BUILD.md toolchain), Release, full CMake configure with BUILD_TESTING=ON. Head 727bb4f1d merged onto main eb7500680. guest_bessel passes. Linux: WSL Ubuntu 24.04, GCC 13.3, Release, same merge: builds, and guest_bessel passes.

Accuracy and bit-exactness. I used a host harness that links Bessel.cpp against FreeBSD release/11.4.0 lib/msun/src/e_j0.c, e_j1.c and e_jn.c:

  • "FMA" build: -O2 -mfma -ffp-contract=fast
  • "NoFMA" build: -mno-fma -ffp-contract=off

All three use the same host sin, cos and log. The reference is mpmath 1.3.0 at 60 digits; above 1e5 it uses the Hankel expansion with exact reduction, which agrees with besselj/bessely to 1e-56. There are 77,972 inputs:

  • log-uniform 1e-300..1e300 with both signs, linear 0..60, tiny and large x
  • ±2 ulp around every threshold
  • ±3 ulp around the first 50 zeros of J0/J1/Y0/Y1 and the first 20 of Jn/Yn for n = 2, 5, 10, 30
  • orders −40..40, 100, 1000, INT_MIN, INT_MIN+1 and INT_MAX
  • ±0, ±inf, NaN, subnormals and DBL_MAX

Results:

  • Against FreeBSD-FMA: 0 bit mismatches on finite results across all of them. This holds at -O2, at -O0, and with the std::fma software path forced (77,918 inputs). Against FreeBSD-NoFMA, thousands differ (y0 on 0..60: 944/4000; jn on 0..2n+20: 2557/4980). The FMA placement is real and right.
  • Against mpmath: the PR's maximum error equals FreeBSD's in every region. Away from zeros, p99 is under 3.1 ulp and max under 3.8 ulp for all six functions on the log-uniform, tiny and large sets. Larger errors occur only near zeros, the usual fdlibm cancellation, and FreeBSD has them too:
    • 2,619 ulp for y0 at x = 3.9577
    • 2.0e4 ulp for jn with n = 100, x = 173.756
  • errno: never set (0 cases). msun has no errno code either.

Domain-error paths differ from the FreeBSD source the debt links. In stable/11, e_j0.c, e_j1.c and e_jn.c compute these with vone/vzero, so they raise exceptions. That came from FreeBSD commit 186f620727 (2015-03-10, "According to POSIX.1-2008 ... should raise a divide-by-zero ... invalid"); release/10.0.0 still had the constant -one/zero.

input FreeBSD 11.4 this PR
y0, y1, yn of ±0 (4 + 4 + 169 cases) -inf, raises FE_DIVBYZERO -inf, raises nothing
y0, y1, yn of x < 0, and yn(-inf) (3,510 / 3,480 / 172 cases) 0xfff8000000000000, raises FE_INVALID 0x7ff8000000000000, raises nothing

The description says the console does the latter, measured by running the console module. We can't reproduce that here, but the debt should say this deliberately departs from the linked msun.

On main, the float versions do the opposite: y0f/y1f/ynf(±0) call feraiseexcept(FE_DIVBYZERO) (Math.cpp:208, #7906, citing e_jn.c). So after this PR, y0(0.0) and y0f(0.0f) disagree on the flag. One of the two needs changing, or a note in the debt.

Minor notes

  • The debt's justification ("MinGW-w64's fma is not correctly rounded", "std::sqrt at -O0 differs from sqrtsd") does not reproduce on the WinLibs UCRT toolchain from BUILD.md. I measured 0/10,000,000 std::fma versus vfmadd in cancellation cases, 0/10,000,000 random, and 0/5,000,000 std::sqrt at -O0 versus sqrtsd. It is specific to the MSYS2 mingw64 (msvcrt) runtime the author used. The workaround is harmless, but the wording overstates it.
  • GuestBessel.cpp lines 137-144 add new uses of std::cyl_bessel_j/std::cyl_neumann, which open #7524 removes from GuestMath.cpp because libc++ (macOS, #7332) lacks them.
  • check_conventions.py warns that the new libc.md entry is 1,362 characters, over the 1,000-character limit.
  • All six NIDs match the SHA-1 of their names. I found no duplicate open or merged PR: #7354 added only the float versions.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6280254372 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7998#issuecomment-6280254372). Originally posted by [wachi35676](https://github.com/wachi35676) on 2026-10-20T00:16:30Z. --- Windows 11, Ryzen 5 9600X, WinLibs GCC 15.2.0 (UCRT, the BUILD.md toolchain), Release, full CMake configure with `BUILD_TESTING=ON`. Head `727bb4f1d` merged onto `main` eb7500680. `guest_bessel` passes. Linux: WSL Ubuntu 24.04, GCC 13.3, Release, same merge: builds, and `guest_bessel` passes. **Accuracy and bit-exactness.** I used a host harness that links `Bessel.cpp` against FreeBSD release/11.4.0 `lib/msun/src/e_j0.c`, `e_j1.c` and `e_jn.c`: - "FMA" build: `-O2 -mfma -ffp-contract=fast` - "NoFMA" build: `-mno-fma -ffp-contract=off` All three use the same host sin, cos and log. The reference is mpmath 1.3.0 at 60 digits; above 1e5 it uses the Hankel expansion with exact reduction, which agrees with `besselj`/`bessely` to 1e-56. There are 77,972 inputs: - log-uniform 1e-300..1e300 with both signs, linear 0..60, tiny and large x - ±2 ulp around every threshold - ±3 ulp around the first 50 zeros of J0/J1/Y0/Y1 and the first 20 of Jn/Yn for n = 2, 5, 10, 30 - orders −40..40, 100, 1000, INT_MIN, INT_MIN+1 and INT_MAX - ±0, ±inf, NaN, subnormals and DBL_MAX Results: - **Against FreeBSD-FMA:** 0 bit mismatches on finite results across all of them. This holds at -O2, at -O0, and with the `std::fma` software path forced (77,918 inputs). Against FreeBSD-NoFMA, thousands differ (y0 on 0..60: 944/4000; jn on 0..2n+20: 2557/4980). The FMA placement is real and right. - **Against mpmath:** the PR's maximum error equals FreeBSD's in every region. Away from zeros, p99 is under 3.1 ulp and max under 3.8 ulp for all six functions on the log-uniform, tiny and large sets. Larger errors occur only near zeros, the usual fdlibm cancellation, and FreeBSD has them too: - 2,619 ulp for y0 at x = 3.9577 - 2.0e4 ulp for jn with n = 100, x = 173.756 - **errno:** never set (0 cases). msun has no errno code either. **Domain-error paths differ from the FreeBSD source the debt links.** In stable/11, `e_j0.c`, `e_j1.c` and `e_jn.c` compute these with `vone`/`vzero`, so they raise exceptions. That came from FreeBSD commit 186f620727 (2015-03-10, "According to POSIX.1-2008 ... should raise a divide-by-zero ... invalid"); release/10.0.0 still had the constant `-one/zero`. | input | FreeBSD 11.4 | this PR | |---|---|---| | y0, y1, yn of ±0 (4 + 4 + 169 cases) | -inf, raises FE_DIVBYZERO | -inf, raises nothing | | y0, y1, yn of x < 0, and yn(-inf) (3,510 / 3,480 / 172 cases) | `0xfff8000000000000`, raises FE_INVALID | `0x7ff8000000000000`, raises nothing | The description says the console does the latter, measured by running the console module. We can't reproduce that here, but the debt should say this deliberately departs from the linked msun. On `main`, the float versions do the opposite: `y0f`/`y1f`/`ynf(±0)` call `feraiseexcept(FE_DIVBYZERO)` (`Math.cpp:208`, #7906, citing `e_jn.c`). So after this PR, `y0(0.0)` and `y0f(0.0f)` disagree on the flag. One of the two needs changing, or a note in the debt. **Minor notes** - The debt's justification ("MinGW-w64's `fma` is not correctly rounded", "`std::sqrt` at -O0 differs from `sqrtsd`") does not reproduce on the WinLibs UCRT toolchain from BUILD.md. I measured 0/10,000,000 `std::fma` versus `vfmadd` in cancellation cases, 0/10,000,000 random, and 0/5,000,000 `std::sqrt` at -O0 versus `sqrtsd`. It is specific to the MSYS2 `mingw64` (msvcrt) runtime the author used. The workaround is harmless, but the wording overstates it. - `GuestBessel.cpp` lines 137-144 add new uses of `std::cyl_bessel_j`/`std::cyl_neumann`, which open #7524 removes from `GuestMath.cpp` because libc++ (macOS, #7332) lacks them. - `check_conventions.py` warns that the new `libc.md` entry is 1,362 characters, over the 1,000-character limit. - All six NIDs match the SHA-1 of their names. I found no duplicate open or merged PR: #7354 added only the float versions. AI-assisted: yes (Claude Code); results above were run on this machine.
priyanshrv-netizen commented 2026-10-20 01:12:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by priyanshrv-netizen on 2026-10-20T01:12:34Z.


Thanks for the thorough review and for running it on WinLibs UCRT and Linux. Pushed 16a7cece3, rebased on main:

  1. The debt now links msun at release/10.0.0, where -one/zero and zero/zero are folded constants, and says this departs from msun since 186f620727. I measured the console behaviour by running the module's code: y0/y1/yn(±0) return -inf, negative arguments return 0x7ff8000000000000, and no flags are raised.
  2. I also ran the console's float versions (0x527C0, 0x53500 and 0x54230 in the same module). They return -inf at ±0 and 0x7fc00000 for negative arguments, raising nothing. So the doubles here match the console, and the feraiseexcept(FE_DIVBYZERO) from #7906 is what differs. The debt now says so, and I left Math.cpp alone to keep this PR to one topic.
  3. Agreed, the inexact fma/sqrt came from the MSYS2 msvcrt runtime. I removed it from the debt and corrected the description.
  4. std::cyl_* is replaced with 60 mpmath 1.3.0 references (1e-12 tolerance; it passes at 1e-14).
  5. The entry is now 975 characters, and check_conventions.py passes without warnings.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6280981392 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7998#issuecomment-6280981392). Originally posted by [priyanshrv-netizen](https://github.com/priyanshrv-netizen) on 2026-10-20T01:12:34Z. --- Thanks for the thorough review and for running it on WinLibs UCRT and Linux. Pushed `16a7cece3`, rebased on `main`: 1. The debt now links msun at `release/10.0.0`, where `-one/zero` and `zero/zero` are folded constants, and says this departs from msun since `186f620727`. I measured the console behaviour by running the module's code: `y0`/`y1`/`yn(±0)` return `-inf`, negative arguments return `0x7ff8000000000000`, and no flags are raised. 2. I also ran the console's float versions (0x527C0, 0x53500 and 0x54230 in the same module). They return `-inf` at ±0 and `0x7fc00000` for negative arguments, raising nothing. So the doubles here match the console, and the `feraiseexcept(FE_DIVBYZERO)` from #7906 is what differs. The debt now says so, and I left `Math.cpp` alone to keep this PR to one topic. 3. Agreed, the inexact `fma`/`sqrt` came from the MSYS2 msvcrt runtime. I removed it from the debt and corrected the description. 4. `std::cyl_*` is replaced with 60 mpmath 1.3.0 references (1e-12 tolerance; it passes at 1e-14). 5. The entry is now 975 characters, and `check_conventions.py` passes without warnings. AI-assisted: yes (Claude Code).
wachi35676 commented 2026-10-20 02:24:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-20T02:24:55Z.


I re-checked 16a7cece3. Bessel.cpp is byte-identical to 727bb4f1d, so the accuracy and bit-exactness results from my earlier comment still apply.

  • Windows: head merged onto main 7e12b3da8, WinLibs GCC 15.2.0 UCRT, Release, full build. guest_bessel passes. ctest -R "math|bessel|nid" passes 15 of 15.
  • Linux: WSL Ubuntu 24.04, GCC 13.3, Release, head merged onto main 049a826e9. guest_bessel passes.
  • Conventions: tools/check_conventions.py --base origin/main passes with no warnings on Python 3.13 and 3.9. The debt entry is now 977 characters.
  • New reference values: I checked all 60 against mpmath 1.3.0 besselj/bessely at 60 digits.
    • The largest relative error is 4.4e-17.
    • 52 of them are the correctly rounded double, and the other 8 are less than 1 ulp off.
    • The test's 1e-12 tolerance is far looser than that.
  • Debt text matches what I found:
    • The link now points to msun release/10.0.0. Its e_j0.c (lines 155-156, 225-226) has the constant -one/zero and zero/zero, and the entry names 186f620727 as the point where msun changed.
    • The ±0 and negative-argument behaviour is described as I measured it.
    • The float y0f/y1f/ynf difference from #7906 is now noted.
    • The MSYS2 fma/sqrt claim is gone.

Nothing else from me.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6281876521 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7998#issuecomment-6281876521). Originally posted by [wachi35676](https://github.com/wachi35676) on 2026-10-20T02:24:55Z. --- I re-checked `16a7cece3`. `Bessel.cpp` is byte-identical to `727bb4f1d`, so the accuracy and bit-exactness results from my earlier comment still apply. - **Windows:** head merged onto `main` 7e12b3da8, WinLibs GCC 15.2.0 UCRT, Release, full build. `guest_bessel` passes. `ctest -R "math|bessel|nid"` passes 15 of 15. - **Linux:** WSL Ubuntu 24.04, GCC 13.3, Release, head merged onto `main` 049a826e9. `guest_bessel` passes. - **Conventions:** `tools/check_conventions.py --base origin/main` passes with no warnings on Python 3.13 and 3.9. The debt entry is now 977 characters. - **New reference values:** I checked all 60 against mpmath 1.3.0 `besselj`/`bessely` at 60 digits. - The largest relative error is 4.4e-17. - 52 of them are the correctly rounded double, and the other 8 are less than 1 ulp off. - The test's 1e-12 tolerance is far looser than that. - **Debt text matches what I found:** - The link now points to msun `release/10.0.0`. Its `e_j0.c` (lines 155-156, 225-226) has the constant `-one/zero` and `zero/zero`, and the entry names `186f620727` as the point where msun changed. - The ±0 and negative-argument behaviour is described as I measured it. - The float `y0f`/`y1f`/`ynf` difference from #7906 is now noted. - The MSYS2 `fma`/`sqrt` claim is gone. Nothing else from me. AI-assisted: yes (Claude Code); results above were run on this machine.
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!7998
No description provided.