Borrowers on the XRP Ledger often find that their final loan installment is one unit higher than scheduled periodic payments. This discrepancy stems from decimal rounding accumulation across the repayment schedule, as each installment is calculated independently. In response to the calculation issue, developers published a draft update to the lending protocol in a GitHub proposal on Nov. 6 under an amendment named LendingProtocolV1_2.
The change focuses on refining the underlying calculation formula for each repayment transaction to prevent decimal discrepancies from compounding.
Closing Decimal Discrepancies with the Telescoping Method
Under the current calculation mechanism, the system computes each periodic payment value (PeriodicPayment) independently without referencing rounding remainders from previous installments. This accumulated rounding from separate calculations frequently causes the final payment to be one unit higher than scheduled. As a result, borrowers find that their closing installment does not match the routine payment amount originally outlined.
To eliminate the buildup of decimal discrepancies, the LendingProtocolV1_2 amendment introduces a calculation method called telescoping. This formula works by leveraging the remaining repayment schedule to accurately reconcile the total outstanding balance (TotalValueOutstanding) each time a LoanPay transaction is executed. Through gradual reconciliation across each remaining installment, borrower obligations are continuously aligned with actual figures without leaving odd rounding remnants when the loan is paid off.
Separation of Code Functions and Interest Protection
The protocol update restructures technical functions at the code level. Developers moved scheduled value calculations from the computeLoanProperties function to a dedicated function named scheduledValue to ensure consistent rounding. The code changes also modify the LoanSet function, which configures loan parameters when a contract is first created.
In addition to fixing rounding formulas, the new system introduces an automatic balance adjustment mechanism when borrowers make an overpayment. The draft proposal also incorporates technical protections to ensure principal allocations do not cause unpaid interest to turn negative. This restriction keeps loan ledger records valid while the protocol processes principal and interest allocations.
A series of tests have been conducted across Legacy, CashBasis, and FixedPrecision vault accounting models. The LendingProtocolV1_2 amendment is currently undergoing technical review before voting on its activation on the XRPL mainnet begins. For XRPL users and borrowers, this mathematical logic fix provides certainty that final settlement figures will align with scheduled periodic payments without an extra unit.
Reported by crypto.news.
Read also: What Is DeFi (Decentralized Finance)?
Disclaimer: This article is for informational and educational purposes only, not financial advice. Cryptocurrency assets are highly volatile and carry significant risk. Always do your own research (DYOR) and never invest more than you can afford to lose.




