Repository navigation
fix(libc): return Dinkumware codes from __fpclassifyf - #11277
oneandonlydean merged 1 commit into
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed exact head 40619ba1cc683093d75fd6450e052a258673522c. The one-line forwarding change makes __fpclassifyf return the same Dinkumware codes as the existing _FDtest helper, and the updated guest test checks that mapping. The PR reports an exhaustive comparison against the bundled libc.prx across all 2^32 float encodings; I did not independently rerun that harness. No blocking code finding. Policy and conventions checks pass; full product builds were skipped under the PR path policy, and my documented manual dispatch attempt was rejected by GitHub because this account lacks repository admin rights.
|
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.
|
|
Windows run of head
AI-assisted: yes (Claude Code); results above were run on this machine. |
|
Windows run of this head
AI-assisted: yes (Claude Code) |
What
__fpclassifyfreturned FreeBSD's<math.h>codes:FP_INFINITE0x01,FP_NAN0x02,FP_NORMAL0x04,FP_SUBNORMAL0x08 andFP_ZERO0x10. #1987 took them from FreeBSD'sfpclassify.c. The console's own__fpclassifyfreturns the Dinkumware codes instead: 0 zero, −2 subnormal, −1 normal, 1 infinite and 2 NaN. Those are the codes that AnyPS5's__fpclassifyd,__fpclassifyland_FDtestalready return.So a title's
fpclassifyon afloatgave the wrong answer for every finite value, while the same call on adoublewas right. Only infinities and NaNs agreed, because FreeBSD and Dinkumware happen to share 1 and 2 there.The evidence is the
libc.prxbundled with PPSA21564, which exports__fpclassifyf(z7aCCd9hMsI) at 0x54790. That code is the library's own:This is
_FDtestfor every input, so__fpclassifyfnow forwards to it.Tested
On Ubuntu 24.04 under WSL2 (GCC 13.3, Release):
Native comparison. I used the harness from fix(libc): compute acosl with FreeBSD msun's ld80 code as the bundled libc.prx does #11260, with that
libc.prx's segments mapped into a Linux process. It runs the binary's__fpclassifyfand AnyPS5's on all 4,294,967,296floatbit patterns:main: every pattern that is not an infinity or NaN differs.The same run finds no mismatch for
__fpclassifydor__fpclassifylon 20,000,000 random encodings each, which confirms that the double and long double versions already used these codes.guest_mathpasses. Its_FDtestcase table covers both zeros, the extreme subnormals, normals, both infinities, and quiet and signalling NaNs. It used to require the FreeBSD constants from__fpclassifyf; it now requires the same code as_FDtest.Conventions.
python3 tools/check_conventions.py --base origin/mainpasses.Overlap.
python3 tools/pr_overlap.py --branch fix/libc-fpclassifyf-dinkumware-codesreports no line overlap. It could not compare 12 PRs that conflict withmain(feat(libc): implement the nextafter and nexttoward families #6295, Macos port #7201, fix(libc): match lgamma's signgam for -0 and its errno at poles as measured on a PS5 #7544, feat(libc): implement tgamma, lgamma, and gamma math functions #8417, fix(libc): compute asinf with FreeBSD msun's algorithm, as titles' libc.prx does #9771, fix(libc): compute log10f and log2f with FreeBSD msun 9.0's algorithms, as titles' libc.prx does #9873, fix(libc): follow msun for log1pf #10007, fix(libc): compute expf with FreeBSD msun's algorithm, as titles' libc.prx does #10113, fix(libc): compute erff and erfcf with fdlibm's algorithm, as titles' libc.prx does #10226, fix(libc): preserve tgammaf underflow sign #10467, fix(libc): preserve acoshf domain errno and exception flags #10610 and feat(libc): implement _LCosh and _LSinh #10742). For each of them,git merge-treeagainstmainand against this branch gives the same conflict count inMath.cppandGuestMath.cpp, so this branch adds no conflict.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)