[libcxx-commits] [libcxx] [libc++][math] Fix undue overflowing of `std::hypot(x, y, z)` (PR #93350)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 4 08:53:43 PDT 2024


================
@@ -41,6 +46,83 @@ inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type hypot(_A1 __x, _
   return __math::hypot((__result_type)__x, (__result_type)__y);
 }
 
+#if _LIBCPP_STD_VER >= 17
+template <class _Real>
+struct __hypot_factors {
+  _Real __threshold;
+  _Real __scale_xyz;
+  _Real __scale_M;
+};
+
+// returns [underflow_factors, overflow_factors]
----------------
ldionne wrote:

Can you please add a comment explaining what this is?

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


More information about the libcxx-commits mailing list