[libc-commits] [libc] [libc][math] Add bit-rounding roundf implementation (PR #221648)
via libc-commits
libc-commits at lists.llvm.org
Wed Sep 16 21:00:20 PDT 2026
================
@@ -109,48 +109,41 @@ LIBC_INLINE constexpr T round(T x) {
using StorageType = typename FPBits<T>::StorageType;
FPBits<T> bits(x);
- // If x is infinity NaN or zero, return it.
- if (bits.is_inf_or_nan() || bits.is_zero())
- return x;
+ // x86 binary80 has NaN encodings with a non-all-ones exponent, so the
+ // biased-exponent check below does not cover every NaN representation.
+ if constexpr (get_fp_type<T>() == FPType::X86_Binary80) {
+ if (bits.is_nan())
----------------
sriramshastry wrote:
Yes, done.
https://github.com/llvm/llvm-project/pull/221648
More information about the libc-commits
mailing list