[libc-commits] [libc] [libc][math] Fix low-precision range reporting and rounding (PR #236472)

via libc-commits libc-commits at lists.llvm.org
Thu Nov 5 08:55:30 PST 2026


================
@@ -104,6 +104,25 @@ LIBC_INLINE constexpr float16 sinhf16(float16 x) {
   uint16_t x_u = x_bits.uintval();
   uint16_t x_abs = x_u & 0x7fffU;
 
+  // The correction to x is nonzero but less than half a subnormal ulp.
+  // Select the adjacent half value directly, preserving signed zero.
+  if (LIBC_UNLIKELY(x_abs != 0 && x_abs < 0x0400U)) {
----------------
lntue wrote:

Can we just fold this to the exceptional checks below?

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


More information about the libc-commits mailing list