[libcxx-commits] [libcxx] [libc++][modules] Remove dependency on __algorithm/max from hypot.h (PR #107150)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 3 14:43:36 PDT 2024


================
@@ -63,7 +62,7 @@ _LIBCPP_HIDE_FROM_ABI _Real __hypot(_Real __x, _Real __y, _Real __z) {
   const _Real __overflow_scale     = __math::ldexp(_Real(1), -(__exp + 20));
 
   // Scale arguments depending on their size
-  const _Real __max_abs = std::max(__math::fabs(__x), std::max(__math::fabs(__y), __math::fabs(__z)));
+  const _Real __max_abs = __builtin_fmax(__math::fabs(__x), __builtin_fmax(__math::fabs(__y), __math::fabs(__z)));
----------------
philnik777 wrote:

Why not simply `__math::fmax`?

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


More information about the libcxx-commits mailing list