Repository navigation
test(libc): cover the exact long double and float rounding exports - #9769
Conversation
guest_math_exact did not reach copysignl, sqrtl, lrintl, llrintl, lrintf, llrintf, scalbf, scalblnf or __isinfl. It now checks copysignl with signed zeros, sqrtl at -1 and -0, the four lrint forms at +-2.5 under each rounding mode with errno untouched, scalbf with fractional, infinite and NaN exponents, scalblnf clamping 64-bit exponents, and __isinfl.
MarcZX10
left a comment
There was a problem hiding this comment.
The test exercises signed-zero copy, long-double square root cases, all four active rounding modes for the lrint* family, scalbf/scalblnf edge exponents, and __isinfl. It also leaves the unrelated _FDclass/_LDclass coverage to #8397 as described. I found no duplicate implementation or overlap with #9771; this PR adds a separate test source only.
Current-main merge-tree, diff-check and conventions pass. The hosted Linux/Windows product tests are skipped for this test-only change, so the Windows guest_math_exact result and negative control are the author’s reported run; I did not run the target locally because this checkout has no configured build and less than 1 GB free disk.
MarcZX10
left a comment
There was a problem hiding this comment.
The approved test-only change still has no code or overlap issue. Current-main diff-check and merge-tree pass, and the hosted register-context/relinker/ASan/write-watch checks pass; product builds are skipped. The branch is based on 8b3e39832a, 32 commits behind current main (11f976b27c16ed91633f00039dba5dfd97dd7cc1). Please rebase and rerun guest_math_exact before merge. I did not rerun locally.
What
Line coverage of libc and libkernel over the CPU-side test suite (gcov, Windows) showed these exact-math exports never running:
copysignl,sqrtl,lrintl,llrintl,lrintf,llrintf,scalbf,scalblnfand__isinfl.How:
tests/GuestMathExact.cpp: a newCheckRoundingAndScaling()checks:copysignl, including signed zeros;sqrtlat 6.25, at -1 (NaN) and at -0 (stays -0);lrintl,llrintl,lrintfandllrintfat ±2.5 under each of the four rounding modes, which pins round-half-even underFE_TONEAREST. The functions use anErrnoGuard, so the check also confirmserrnois left alone;scalbfwith integral, fractional (NaN), NaN and ±infinite exponents;scalblnfwith exponents of ±10 and the 64-bit limits (clamped);__isinflfor ±infinity, a finite value, zero and NaN._FDclass/_LDclass, which feat(libc): add Dinkumware float bit helpers from firmware #8397 changes, andlogbl,lroundlandfinitef, which other tests name. The declarations, function and call sit apart from the existing checks.Tested
guest_math_exactpasses.lrintfusingllround(which ignores the rounding mode), the test fails. Restored, it passes.tools/check_conventions.pypasses.Overlap (
tools/pr_overlap.py --branchplusgit merge-tree):tools/pr_overlap.py --branchreports no open PR sharing the changed lines;git merge-treeagainst feat(libc): add Dinkumware float bit helpers from firmware #8397 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)