mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-27 09:00:32 +00:00
Small fixes for Loan merge
- Skip roundToScale work for 0 values. - Expand a couple of test values to higher precision.
This commit is contained in:
@@ -1473,6 +1473,10 @@ roundToScale(
|
||||
if (value.integral())
|
||||
return value;
|
||||
|
||||
// Nothing to do for zero.
|
||||
if (value == beast::zero)
|
||||
return value;
|
||||
|
||||
// If the value's exponent is greater than or equal to the scale, then
|
||||
// rounding will do nothing, and might even lose precision, so just return
|
||||
// the value.
|
||||
|
||||
@@ -2392,7 +2392,7 @@ protected:
|
||||
interval * Number(12, -2) / secondsInYear;
|
||||
BEAST_EXPECT(
|
||||
periodicRate ==
|
||||
Number(2283105022831050, -21, Number::unchecked{}));
|
||||
Number(2283105022831050228ULL, -24, Number::normalized{}));
|
||||
STAmount const principalOutstanding{
|
||||
broker.asset, state.principalOutstanding};
|
||||
STAmount const accruedInterest{
|
||||
@@ -2624,7 +2624,7 @@ protected:
|
||||
interval * Number(12, -2) / secondsInYear;
|
||||
BEAST_EXPECT(
|
||||
periodicRate ==
|
||||
Number(2283105022831050, -21, Number::unchecked{}));
|
||||
Number(2283105022831050228, -24, Number::normalized{}));
|
||||
STAmount const roundedPeriodicPayment{
|
||||
broker.asset,
|
||||
roundPeriodicPayment(
|
||||
|
||||
Reference in New Issue
Block a user