[libc-commits] [libc] [llvm] Reland "[libc][math] Refactor fmaximum_mag_num family to header-only" (PR #194194)
Muhammad Bassiouni via libc-commits
libc-commits at lists.llvm.org
Sat Apr 25 16:30:44 PDT 2026
================
@@ -33,25 +33,30 @@ LIBC_INLINE constexpr T abs(T x) {
namespace internal {
template <typename T>
-LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> max(T x, T y) {
+LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_floating_point_v<T>, T>
+constexpr_max(T x, T y) {
FPBits<T> x_bits(x);
FPBits<T> y_bits(y);
-
- // To make sure that fmax(+0, -0) == +0 == fmax(-0, +0), whenever x and y
- // have different signs and both are not NaNs, we return the number with
- // positive sign.
if (x_bits.sign() != y_bits.sign())
----------------
bassiounix wrote:
```suggestion
LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_floating_point_v<T>, T>
constexpr_max(T x, T y) {
FPBits<T> x_bits(x);
FPBits<T> y_bits(y);
// To make sure that fmax(+0, -0) == +0 == fmax(-0, +0), whenever x and y
// have different signs and both are not NaNs, we return the number with
// positive sign.
if (x_bits.sign() != y_bits.sign())
```
https://github.com/llvm/llvm-project/pull/194194
More information about the libc-commits
mailing list