fix(tests): compare the Bessel exports with fixed reference values #7524

Merged
jotitadev merged 1 commit from upstream-pr/7524 into main 2026-10-20 15:16:09 +00:00
jotitadev commented 2026-10-18 12:05:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-18T12:05:10Z.


What

#7354 added j0f, jnf and ynf checks to GuestMath.cpp that compare against std::cyl_bessel_j and std::cyl_neumann. libc++ does not implement the C++17 special math functions, so the test no longer compiles on macOS (no member named 'cyl_bessel_j' in namespace 'std', lines 840, 841 and 843). The three checks now compare against fixed values of J0(2.5), J3(4.0) and Y2(3.0). The tolerance (1e-6f) and the inputs are unchanged.

Reference values, as printed by the host j0/jn/yn:

macOS 27.2 libm glibc (Ubuntu 26.04) used
J0(2.5) -0.048383776468198 -0.04838377646819799 -0.048383776468198
J3(4.0) 0.43017147387562193 0.43017147387562193 0.430171473875622
Y2(3.0) -0.1604003934849237 -0.1604003934849238 -0.160400393484924

Part of getting main to build on macOS in small pieces, as discussed in #1. It is the only error left in a survey build of main with @mugurc's macOS series on top; nothing in that series or in the open macOS PRs touches these lines.

Tested

macOS 27.2 on an Apple M2 Max, Xcode 27 (Apple clang 21.0.0, libc++), x86-64 full build configured as docs/dev/BUILD.md describes (-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON). The full build on macOS is x86-64 only (CMakeLists.txt stops an arm64 configure), so there is no native arm64 run.

  • main 3e3e8b905: GuestMath.cpp.o fails with the three errors above.
  • This branch: GuestMath.cpp.o compiles.

Not run: guest_math itself. It links against libc, which does not build on main on macOS yet. On a local tree with @mugurc's series it links but aborts at the strtol errno check that #6853 covers; with #6853 on top it still aborts, at a check I have not located yet, so the three changed checks have not run on macOS.

Linux x86-64 (Ubuntu 26.04, GCC 15.2, libstdc++), same configure, this branch merged on main 0d078f75d, guest_math_tests target:

  • ctest -R guest_math passes, as it does with the main version of GuestMath.cpp.
  • Changing the Y2(3.0) constant by 1e-5 makes guest_math abort, so the changed checks do run.
  • libstdc++ std::cyl_bessel_j(0, 2.5), std::cyl_bessel_j(3, 4.0) and std::cyl_neumann(2, 3.0) differ from the constants by at most 6e-17 and round to the same float.
  • ctest -R conventions_: 21/21.

Not tested: Windows build.

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:4908940490 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7524). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-18T12:05:10Z. --- ### What #7354 added `j0f`, `jnf` and `ynf` checks to `GuestMath.cpp` that compare against `std::cyl_bessel_j` and `std::cyl_neumann`. libc++ does not implement the C++17 special math functions, so the test no longer compiles on macOS (`no member named 'cyl_bessel_j' in namespace 'std'`, lines 840, 841 and 843). The three checks now compare against fixed values of J0(2.5), J3(4.0) and Y2(3.0). The tolerance (`1e-6f`) and the inputs are unchanged. Reference values, as printed by the host `j0`/`jn`/`yn`: | | macOS 27.2 libm | glibc (Ubuntu 26.04) | used | |---|---|---|---| | J0(2.5) | -0.048383776468198 | -0.04838377646819799 | -0.048383776468198 | | J3(4.0) | 0.43017147387562193 | 0.43017147387562193 | 0.430171473875622 | | Y2(3.0) | -0.1604003934849237 | -0.1604003934849238 | -0.160400393484924 | Part of getting `main` to build on macOS in small pieces, as discussed in #1. It is the only error left in a survey build of `main` with @mugurc's macOS series on top; nothing in that series or in the open macOS PRs touches these lines. ### Tested macOS 27.2 on an Apple M2 Max, Xcode 27 (Apple clang 21.0.0, libc++), x86-64 full build configured as `docs/dev/BUILD.md` describes (`-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON`). The full build on macOS is x86-64 only (`CMakeLists.txt` stops an arm64 configure), so there is no native arm64 run. - `main` 3e3e8b905: `GuestMath.cpp.o` fails with the three errors above. - This branch: `GuestMath.cpp.o` compiles. Not run: `guest_math` itself. It links against `libc`, which does not build on `main` on macOS yet. On a local tree with @mugurc's series it links but aborts at the `strtol` errno check that #6853 covers; with #6853 on top it still aborts, at a check I have not located yet, so the three changed checks have not run on macOS. Linux x86-64 (Ubuntu 26.04, GCC 15.2, libstdc++), same configure, this branch merged on `main` 0d078f75d, `guest_math_tests` target: - `ctest -R guest_math` passes, as it does with the `main` version of `GuestMath.cpp`. - Changing the Y2(3.0) constant by 1e-5 makes `guest_math` abort, so the changed checks do run. - libstdc++ `std::cyl_bessel_j(0, 2.5)`, `std::cyl_bessel_j(3, 4.0)` and `std::cyl_neumann(2, 3.0)` differ from the constants by at most 6e-17 and round to the same `float`. - `ctest -R conventions_`: 21/21. Not tested: Windows build. ### 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 - [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-18 12:36:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T12:36:34Z.


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 6044 core/libs/tests/GuestMath.cpp
PR 6158 core/libs/tests/GuestMath.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6249992610 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7524#issuecomment-6249992610). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T12:36:34Z. --- <!-- 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 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestMath.cpp` | | [PR 6158](https://www.github.com/boykopovar/AnyPS5/pull/6158) | `core/libs/tests/GuestMath.cpp` |
LeandroLP23 commented 2026-10-18 17:10:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T17:10:40Z.


Windows build and run, since the description lists the Windows build as not tested. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. Build: main 6efb7261b with #7524, #7006, #6612, #6929, #7119, #6896 and #6856 merged together (each merge clean, built once).

The build is clean and guest_math passes 3 runs of 3.

AI-assisted

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6252729337 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7524#issuecomment-6252729337). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-18T17:10:40Z. --- Windows build and run, since the description lists the Windows build as not tested. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`. Build: `main` `6efb7261b` with #7524, #7006, #6612, #6929, #7119, #6896 and #6856 merged together (each merge clean, built once). The build is clean and `guest_math` passes 3 runs of 3. AI-assisted
jotitadev commented 2026-10-19 18:36:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T18:36:25Z.


Rebased onto main (f8545e961e) after #7906 conflicted on the same lines. The resolution keeps #7906's new ynf(2, 0) == -inf check and swaps only the std::cyl_neumann(2.0, 3.0) reference for the fixed value, so the test no longer calls std::cyl_* anywhere.

Rebuilt guest_math_tests on Linux (x86-64) and ran ctest -R '^guest_math$': passes.

Written with AI assistance (Claude Code).
I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6274476324 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7524#issuecomment-6274476324). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-19T18:36:25Z. --- Rebased onto `main` (`f8545e961e`) after #7906 conflicted on the same lines. The resolution keeps #7906's new `ynf(2, 0) == -inf` check and swaps only the `std::cyl_neumann(2.0, 3.0)` reference for the fixed value, so the test no longer calls `std::cyl_*` anywhere. Rebuilt `guest_math_tests` on Linux (x86-64) and ran `ctest -R '^guest_math$'`: passes. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
adriadam10 commented 2026-10-20 15:16:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T15:16:55Z.


Checked the three constants (J0(2.5), J3(4.0), Y2(3.0)) against reference values on current main, all agree to well below the 1e-6f tolerance; inputs and tolerance unchanged, no std::cyl_* left in the test. Windows run by @LeandroLP23 passes; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6294285105 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7524#issuecomment-6294285105). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-20T15:16:55Z. --- Checked the three constants (J0(2.5), J3(4.0), Y2(3.0)) against reference values on current main, all agree to well below the 1e-6f tolerance; inputs and tolerance unchanged, no `std::cyl_*` left in the test. Windows run by @LeandroLP23 passes; merged.
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!7524
No description provided.