From 42a11069524f223765ea03b8fc12b863924858f3 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Fri, 12 Jun 2026 14:54:27 -0400 Subject: [PATCH] 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. --- include/xrpl/basics/Number.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index 9c137b08fa..79c9308139 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -525,10 +525,13 @@ public: return !lneg; // If equal signs and exponents, compare mantissas. - if (lneg) + if constexpr (std::is_unsigned_v) { - // 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_;