[libc-commits] [libc] [libc][math] Add bit-rounding roundf implementation (PR #221648)

via libc-commits libc-commits at lists.llvm.org
Wed Sep 9 20:51:56 PDT 2026


================
@@ -109,48 +109,39 @@ 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())
+  // If x is infinity or NaN, return it.
+  if (bits.is_inf_or_nan())
----------------
sriramshastry wrote:

Removed the redundant general` is_inf_or_nan()` check. I kept a `binary80-only NaN` guard because x86 extended precision has `NaN` encodings that are not covered by the biased-exponent threshold.

https://github.com/llvm/llvm-project/pull/221648


More information about the libc-commits mailing list