[libc-commits] [libc] [libc][math][c23] Add hypotf16 function (PR #131991)

via libc-commits libc-commits at lists.llvm.org
Sat Mar 29 19:41:17 PDT 2025


================
@@ -207,8 +207,9 @@ LIBC_INLINE T hypot(T x, T y) {
 
   for (StorageType current_bit = leading_one >> 1; current_bit;
        current_bit >>= 1) {
-    r = (r << 1) + ((tail_bits & current_bit) ? 1 : 0);
-    StorageType tmp = (y_new << 1) + current_bit; // 2*y_new(n - 1) + 2^(-n)
+    r = (StorageType)(r << 1) + ((tail_bits & current_bit) ? 1 : 0);
+    StorageType tmp =
+        (StorageType)(y_new << 1) + current_bit; // 2*y_new(n - 1) + 2^(-n)
----------------
lntue wrote:

nit: use C++ cast instead of C cast, either `static_cast<>` or `StorageType()`

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


More information about the libc-commits mailing list