Merge remote-tracking branch 'XRPLF/develop' into ximinez/lending-refactoring-1

* XRPLF/develop:
  Add `Scale` to SingleAssetVault (5652)
This commit is contained in:
Ed Hennis
2025-09-04 12:25:49 -04:00
17 changed files with 1869 additions and 221 deletions

View File

@@ -150,6 +150,24 @@ public:
return (mantissa_ < 0) ? -1 : (mantissa_ ? 1 : 0);
}
Number
truncate() const noexcept
{
if (exponent_ >= 0 || mantissa_ == 0)
return *this;
Number ret = *this;
while (ret.exponent_ < 0 && ret.mantissa_ != 0)
{
ret.exponent_ += 1;
ret.mantissa_ /= rep(10);
}
// We are guaranteed that normalize() will never throw an exception
// because exponent is either negative or zero at this point.
ret.normalize();
return ret;
}
friend constexpr bool
operator>(Number const& x, Number const& y) noexcept
{