Repository navigation
Conversation
round returned the host's result. The Windows UCRT passes a signalling NaN through unchanged, while msun's round returns it quieted, with its payload and sign (through floor, which returns x + x for a NaN). Return x + x for a NaN as trunc, ceil, floor and nearbyint here already do; every other argument still goes to the host. The new test pins 22 inputs to the bits a local build of msun returned. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
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.
|
|
A runtime check of this head ( Setup: a scratch loader runs the decrypted
Update: the AI-assisted: yes (Claude Code). |
|
Thank you for running this differential. This change rested only on msun's AI-assisted (Claude Code). |
What
roundreturned the host's result. On Windows (UCRT) that passes a signalling NaN through unchanged. FreeBSD 11.4'ss_round.creturns it quieted, with its payload and sign: it returnsx + xfor infinities and for NaNs with a zero high mantissa word, and otherwise goes throughfloor, which returnsx + xfor a NaN (s_floor.c). For example,round(0x7ff0000000000001)is0x7ff8000000000001there and0x7ff0000000000001here.roundnow returnsx + xfor a NaN argument and calls the host otherwise, astrunc,ceil,floorandnearbyintdo since #10370. The effect is limited to signalling NaNs on Windows/UCRT: on Linux with glibc 2.39 the host already quiets them (0 differences in 4,000,000 random arguments), and no result for any other argument changes. This claims no benefit for any title. Thelibc.prxthat titles ship has not been measured forround; #10370 compared its eight functions with titles' copies, this change follows msun's source only.roundfis unchanged: it matched msun on both hosts in the same 4,000,000 arguments.The test
guest_mathgetsCheckRoundNaNBits: 22 arguments with the bits of a local build of msun'sroundas the expected values (signalling NaNs of both signs with payloads, quiet NaNs of both signs, both infinities, both zeros, 1, 2.5, -2.5, 0.5, -0.5, 1.5, -1.5, the largest double below 0.5 and its negative, the smallest subnormal andDBL_MAX).Tested
maine0cd1259a9(ninja exit code 0):guest_mathpasses 5 of 5 runs;guest_math_exactandguest_dinkumware_internalspass.Math.cppofmain(the change reverted) and the new test,guest_mathfails on Windows (exit code 0xc0000409) with "Guest round failed for 7ff0000000000001: got 7ff0000000000001, expected 7ff8000000000001".round_nid_postfix, each makingguest_mathfail on Windows with the failing argument in the message: the NaN check removed, the check true only for positive NaNs, true only for quiet NaNs, a NaN returned as 0, andtruncinstead ofround.-O3):guest_mathpasses 5 of 5 runs, andguest_math_exactandguest_dinkumware_internalspass. It passes before and after the change, because glibc already quiets the NaN, so the NaN checks have no effect there; of the five defects only the NaN-to-0 and thetruncones fail on Linux.lib/msun(BSD licence; not in the repository) with all its symbols renamed, compared on random arguments with the host'sround; that measures these hosts against msun, not a console or a title.roundland the floating-point exception flags.Overlap
No open PR changes
round_nid_postfix, androundhas no other open or merged PR; #10370 (merged) did the same fortrunc,ceil,floorandnearbyint. 49 of the 1,321 open PRs touchMath.cpporGuestMath.cpp, and 4 more list 100 or more files and were checked as well;git merge-treeof this head with each of the 53: 45 merge without a conflict and 8 conflict, all 8 of which already conflict withmainon their own. None conflicts only with this change, so there is noDepends on.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)