fix(libc): exp2 leaves errno unchanged #3599
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3599"
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 CouchRiv on 2026-10-11T14:07:18Z.
What
exp2(1024.0)sets errno to 34 onmain. FreeBSD msun reports math errors through floating-point exceptions only and never sets errno (math.h#L67-L69), so a caller that checks errno afterexp2sees a stale error onmain.exp2now saves errno before the host call and restores it after; the result and the floating-point flags do not change.Tested
CachyOS Linux, RTX 4070 Ti (NVIDIA) and Radeon 610M (RADV), lavapipe for CI parity.
exp2_nid_postfixchecks fail onmainand pass with the change; 1/1 on NVIDIA, RADV and lavapipe.tools/check_conventions.py --base origin/mainandgit diff --check: clean.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T15:20:14Z.
Independent pre-review on Linux (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON.tools/check_conventions.py --base origin/mainpasses.