Expand LoanPay test cases, and fix rounding errors

- At least rounding errors for a full payoff
This commit is contained in:
Ed Hennis
2025-05-09 00:27:52 -04:00
parent 368e496d5f
commit bd014e270a
5 changed files with 109 additions and 51 deletions

View File

@@ -697,12 +697,14 @@ getRate(STAmount const& offerOut, STAmount const& offerIn);
template <AssetType A>
Number
roundToAsset(A const& asset, Number const& value)
roundToAsset(
A const& asset,
Number const& value,
Number::rounding_mode rounding = Number::getround())
{
NumberRoundModeGuard mg(rounding);
STAmount const amount{asset, value};
if (amount != value)
return amount;
return value;
return amount;
}
//------------------------------------------------------------------------------