Merge pull request #5256 from adriadam10/fix/libc-acosf-nan-bits

fix(libc): choose the acosf NaN bits instead of the host libm
This commit is contained in:
Adrià 2026-10-13 17:46:36 +02:00 committed by GitHub
commit c7beafd21a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -183,6 +183,12 @@ float APS5_VABI asinf_nid_postfix(float x) {
return result;
}
float APS5_VABI acosf_nid_postfix(float x) {
if (std::isnan(x)) {
return std::bit_cast<float>(std::bit_cast<std::uint32_t>(x) | 0x00400000u);
}
if (std::fabs(x) > 1.0f) {
return std::bit_cast<float>(0xffc00000u);
}
const int saved_errno = errno;
const float result = std::acos(x);
errno = saved_errno;