Repository navigation
fix(libc): choose the acosf NaN bits instead of the host libm - #5256
Merged
Merged
Conversation
FreeBSD msun e_acosf.c returns (x-x)/(x-x) for |x| > 1 and NaN inputs: the x86 default NaN 0xffc00000, or the quieted input NaN. std::acos left it to the host libm, and guest_math failed on the runner's glibc 2.39. Co-Authored-By: Claude <noreply@anthropic.com>
10 tasks done
10 tasks done
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
guest_mathhas failed on everymainpush build since #3688:CheckAcosfErrnopinsacosf(2.0f)to0xffc00000, andacosfhanded the NaN to the hoststd::acos. Our glibc 2.44 returns0xffc00000, but the runner's glibc 2.39 doesn't.This change picks the bits explicitly, following FreeBSD msun
e_acosf.c, which returns(x-x)/(x-x)for|x| > 1and for NaN inputs:|x| > 1(including ±inf), it returns the x86 default NaN0xffc00000.In-domain inputs still go to
std::acos, and errno stays untouched.Tested
The change is a 6-line rewrite of the NaN path only. Merged without waiting for CI to unblock
main; the next push build onmainis the check.