fix(libc): return -inf from y0f, y1f and ynf at zero #7906
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7906"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Rajkamalcode on 2026-10-19T13:07:55Z.
What
The guest's second-kind Bessel functions return -inf with a divide-by-zero signal at
+-0(y0(+-0),y1(+-0)andyn(n,+-0), see e_jn.c), but the UCRT returns NaN fory1andyn(and raises wrong flags anderrnofory0).y0f,y1fandynfnow return the guest result forx == +-0through a shared helper, andguest_mathgainsynf(2, 0.0f)coverage. The libc technical debt entry for these functions notes the special case; the rest of their behaviour still follows the host.Overlap: #7524 replaces the
std::cyl_bessel_j/std::cyl_neumanncomparisons in the same test file, a few lines below the newynf(2, 0.0f)check; this branch is self-contained and will rebase on it if it lands first.Tested
Windows 11 (22635.5305), MinGW-w64 GCC 15.2.0 (winlibs), Ryzen 5 5600X, based on
mainf3bb6a4f8. Host probe of the UCRT:y0(+0) = -inf(withERANGE),y1(+-0) = NaN,yn(2,+-0) = NaN(the full matrix is in a comment below). WithMath.cppatmain,ctest --test-dir build -R '^guest_math$'fails at they1f(0.0f) == -infcheck (exit 0xc0000409,FATAL: abort()); with this change it passes. Only the float variants exist (y0/y1/ynare not implemented yet).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by Rajkamalcode on 2026-10-19T13:08:12Z.
Host probe of the UCRT's Bessel functions (MinGW-w64 GCC 15.2.0 winlibs, Windows 11, Ryzen 5 5600X),
g++ -O2 -o bessel-probe2.exe bessel-probe2.cpp, against the console behaviour of FreeBSD msune_j0.c/e_j1.c/e_jn.c:errno34 isERANGE, 33 isEDOM.y0(+0)already had the right value but the UCRT still setserrnoand raises its own flags there, wheree_jn.cdocuments only the divide-by-zero signal for all three functions.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T13:13:43Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/tests/GuestMath.cppL878-881Some 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.
docs/dev/debt/libc.mdcore/libs/tests/GuestMath.cppcore/libs/prx/libc/src/Math.cppcore/libs/tests/GuestMath.cppdocs/dev/debt/libc.mdcore/libs/prx/libc/src/Math.cppcore/libs/tests/GuestMath.cppdocs/dev/debt/libc.mdcore/libs/prx/libc/src/Math.cppdocs/dev/debt/libc.mdcore/libs/prx/libc/src/Math.cppcore/libs/prx/libc/src/Math.cppcore/libs/tests/GuestMath.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.md