fix: Fix Number comparison operator for signed types

- Instead of completely removing the code, it is wrapped in an `if
  constexpr` sign check. That way, it's future proof in case the type of
  mantissa_ ever changes again.
- Ironically, this partially reverts PR 7406.
This commit is contained in:
Ed Hennis
2026-06-12 14:54:27 -04:00
parent f75f3ca2ad
commit 42a1106952

View File

@@ -525,10 +525,13 @@ public:
return !lneg;
// If equal signs and exponents, compare mantissas.
if (lneg)
if constexpr (std::is_unsigned_v<decltype(l.mantissa_)>)
{
// If negative, the operator is reversed.
return l.mantissa_ > r.mantissa_;
if (lneg)
{
// If negative, the operator is reversed.
return l.mantissa_ < r.mantissa_;
}
}
return l.mantissa_ < r.mantissa_;