[libc-commits] [libc] [llvm] [libc][math] Do not use float16 basic operations in hypotf16. (PR #155177)

via libc-commits libc-commits at lists.llvm.org
Sun Aug 24 14:28:50 PDT 2025


================
@@ -133,8 +134,17 @@ LIBC_INLINE T hypot(T x, T y) {
   uint16_t a_exp = a_bits.get_biased_exponent();
   uint16_t b_exp = b_bits.get_biased_exponent();
 
-  if ((a_exp - b_exp >= FPBits_t::FRACTION_LEN + 2) || (x == 0) || (y == 0))
-    return x_abs.get_val() + y_abs.get_val();
+  if ((a_exp - b_exp >= FPBits_t::FRACTION_LEN + 2) || (x == 0) || (y == 0)) {
+    if constexpr (cpp::is_same_v<T, float16>) {
----------------
lntue wrote:

Fixed.

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


More information about the libc-commits mailing list