diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index a1cf296aed..b1a0bb7e8e 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -356,7 +356,7 @@ Number::operator-() const noexcept inline Number& Number::operator++() { - *this += Number{1000000000000000, -15, unchecked{}}; + *this += one(); return *this; } @@ -371,7 +371,7 @@ Number::operator++(int) inline Number& Number::operator--() { - *this -= Number{1000000000000000, -15, unchecked{}}; + *this -= one(); return *this; } diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index 588906652b..a1682ebde7 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -563,13 +563,13 @@ inline std::tuple STAmount::scaleNumber(A const& asset, Number const& number) { bool const negative = number.mantissa() < 0; + Number const working{negative ? -number : number}; if (asset.integral()) { - return std::make_tuple(std::int64_t(number), 0, negative); + return std::make_tuple(std::int64_t(working), 0, negative); } else { - Number const working{negative ? -number : number}; auto const [mantissa, exponent] = working.normalizeToRange(cMinValue, cMaxValue);