Repository navigation
fix(libc): accept the full llroundl integer range - #4942
Merged
oneandonlydean merged 2 commits intoOct 14, 2026
Merged
Conversation
This was referenced Oct 13, 2026
Contributor
|
Windows test of this PR. Environment: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, Result: guest_math (1 of 1; the test file is shared with #4946, both merged together) pass. Not checked: whether the test fails without the change in the library code; the PR was not tested alone, only in the combined merge (the tests of the other PRs in the batch also pass); no title run; Linux not tested. AI-assisted (Claude Code). |
This was referenced Oct 13, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Accept the complete signed 64-bit result range in
llroundl. On main,llroundl(9223372036854775807.0L)returnsINT64_MINand raisesFE_INVALID, although the input is exactly representable in the guest's x87 extended format and the correct rounded result isINT64_MAX.The shared rounding helper uses an exclusive upper bound of
static_cast<TFloat>(INT64_MAX). That bound becomes 2^63 for float and double but staysINT64_MAXfor long double, excluding the largest valid integer. Use the exactly representable 2^63 bound in every specialization. The existing float/double range checks and invalid-input handling retain their behavior.The valid result agrees with FreeBSD's
s_llroundl.cand itss_lround.c, which includes the maximum integer within the long-double input range.Tested
Windows, MinGW GCC 15.2, Release,
BUILD_TESTING=ON; negative control on main7e181fcc3, final branch rebased onto88107b7de:expected 9223372036854775807, got -9223372036854775808.FE_INVALIDand preserves the caller's errno. Existing float/double boundary cases also pass.guest_sce_net,guest_poll,guest_socket_read_write,guest_tcp,guest_socket_pair,guest_dup,guest_socket_eventsandguest_fstatfs). Avast's log records automatic sandboxing of the test programs. The local full-build limitation remains; local full-build success is not claimed.Review validation
Ready for maintainer review. Full Linux/Windows CI requires a maintainer's manual dispatch; marking this PR ready does not claim those jobs passed.
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