Amortization Series · Part III
A software engineering perspective on precision boundaries, source of truth, and why rounding is a domain decision — not a formatting detail.
Equal payments sound simple until you implement them.
At first, it is tempting to think of a monthly loan payment as a single number: $XXX.YY. A borrower sees one amount on a statement. A product requirement may say that all monthly payments should be the same. A calculator may produce a clean result. A spreadsheet may show a neat schedule.
But in a financial system, that “same payment” may exist at more than one level of precision. There may be:
Those are related, but they are not always the same thing. This article is the conclusion of my exploration into amortization schedules, day-count conventions, Newton-Raphson calculations, direct derivatives, and penny-level drift. The main lesson is simple:
When we say that a loan has “equal monthly payments,” what exactly do we mean?
There are at least two possible interpretations.
The first interpretation is display equality:
Payment 1: $523.41
Payment 2: $523.41
Payment 3: $523.41
...
From the borrower’s perspective, these payments are equal. The same amount appears every month.
The second interpretation is internal equality:
Payment 1: 523.4149261837
Payment 2: 523.4149261837
Payment 3: 523.4149261837
...
From the system’s perspective, these payments are also equal, but at a much higher precision.
The subtle problem is that these two ideas can diverge. A payment displayed as $523.41 may actually be backed by an internal value like 523.4149261837. If the system uses the high-precision value internally and only rounds for presentation, the schedule behaves differently than if the system first rounds the payment to $523.41 and then uses that rounded value for every calculation. Both approaches can look reasonable. Both can be explained mathematically. But they produce different amortization behavior.
That is why “same payment” is not precise enough as an implementation requirement. A better requirement would specify:
The most important question is not just what is the payment?
It is: when is the payment rounded, and is the rounded value used for subsequent calculations? Consider two simplified models.
Model A · Round first
Calculated: 523.4149261837 Rounded: 523.41 Internal: 523.41 Displayed: 523.41
Model B · Preserve precision
Calculated: 523.4149261837 Internal: 523.4149261837 Displayed: 523.41
In Model A, the system uses $523.41 for every period’s interest, principal, and balance. Simple and intuitive — but introduces a small, permanent gap between the ideal payment and the value actually used. In Model B, the borrower still sees $523.41, but the schedule runs on the full-precision value. The important insight: $523.41 may be a display representation, not the computational source of truth. That distinction changes everything.
A common trap in amortization modeling is to treat the displayed payment as the real payment.
That is natural because money is usually represented in cents. Borrowers pay cents. Statements display cents. Ledger entries often settle in cents.
But formulas do not naturally stop at cents. They produce decimal values with more precision than any currency field can display — this is the nature of floating-point arithmetic. A computed payment of 523.4149261837 is not a rounded number waiting to be truncated; it is the exact result of the formula at full precision. So there is a design choice:
Option 1:
Option 2:
Those options are not equivalent.
In the first option, rounding becomes an input to the amortization schedule. It changes future balances.
In the second option, rounding becomes an output boundary. It changes what people see, but does not change the internal math at each step.
That difference is why rounding cannot be treated as a minor formatting detail. It is a domain decision.
Day-count conventions add another layer of complexity.
A 30/360 convention treats each month as if it has 30 days and each year as if it has 360 days. This creates uniform periods for many monthly loan calculations — a regular loan. Actual/365 uses the actual number of days in each period over a 365-day year. One period may accrue interest for 28 days, another for 30, another for 31. This is an irregular loan.
This matters because interest allocation changes by period. Different actual-day conventions answer this slightly differently:
Under a simple Actual/X convention, the interest factor depends on actual days in the period:
period interest factor = annual rate × actual days / days in year
So even if the displayed payment is the same every month, the split between interest and principal can vary. A longer period accrues more interest. A shorter period accrues less. The payment may remain visually equal while the allocation inside it changes.
Same loan · Same payment · How the interest/principal split shifts by convention
Principal $50,000 · 7.5% annual rate · 24 months. The dashed line marks the same monthly payment across all three bars. Under Actual/365, more days in the period = more interest accrued = less principal paid. The payment stays the same; the split inside it changes.
This leads to an important distinction: the day-count convention affects interest allocation. Precision and rounding rules affect whether equal displayed payments can be preserved cleanly. It is easy to confuse those two.
Suppose the mathematically ideal payment is 523.4149261837. If the system rounds this to 523.41, the difference is 0.0049261837 — less than half a cent.
Ideal: 523.4149261837
Rounded: 523.41
Gap: 0.0049261837 (<½ cent)
But amortization is iterative. Each period depends on the previous balance. If the payment is slightly lower than the ideal high-precision value, the principal reduction is slightly lower. That leaves a slightly higher balance. A slightly higher balance can produce slightly higher interest in the next period. The effect compounds through the schedule.
This does not necessarily create a huge error, but it can create enough drift that the final payment differs from the standard payment, or the final balance needs an explicit adjustment.
That drift is not random. It is the consequence of a modeling decision: the system chose to use the rounded value as a computational input.
Now consider the alternative. The system calculates the payment with high precision and keeps that value internally:
Internal payment: 523.4149261837
Displayed payment: $523.41
Each period uses the internal payment value for the amortization calculation. The displayed schedule still shows $523.41, but the internal balance evolves according to the more precise payment.
The key idea: the payment shown is not always the payment used internally.
Those boundaries matter. For example:
Each choice creates a different schedule. None of these choices should be accidental.
From a software engineering perspective, the core lesson is that amortization is not just a formula. It is a set of domain rules. A robust implementation should define the following explicitly.
Which value is authoritative?
Different systems may need different answers. The problem is not that one answer is universally correct. The problem is leaving the answer implicit.
Where does the system preserve precision, and where does it round? Possible boundaries include:
Each boundary should be intentional.
Financial calculations should avoid binary floating-point types for money-sensitive calculations. A decimal type, fixed-point representation, or domain-specific money type is usually safer.
The important point is not only the data type, but also the rounding mode and scale. For example:
amount.round(scale: 2, mode: HALF_UP)
amount.round(scale: 10, mode: HALF_EVEN)
Those choices should be named and tested.
Formatting a number for display is not the same as defining the value used by the domain model.
This is the trap:
display(payment) -> "$523.41" // changes representation
payment = round(payment, 2) // changes the value
The first changes representation.
The second changes the value.
In financial systems, that distinction is fundamental.
Even with careful precision handling, many schedules need explicit final-period behavior. The final payment may need to close the remaining balance. The system may need to reconcile principal, interest, fees, and rounding residuals. The product may define whether the last payment can differ, whether the difference is absorbed somewhere else, or whether the schedule is adjusted earlier.
That behavior should not be left to incidental arithmetic. It should be a business rule.
The tests for an amortization system should do more than check that the formula returns a plausible payment. They should test the invariants the business actually cares about.
If the product promises equal displayed payments, test that the borrower-facing payments are equal at the display precision.
displayedPayment(period_1) == displayedPayment(period_2)
But be explicit that this is display equality, not necessarily internal equality.
Test that the internal balance evolves as expected under the chosen precision model.
starting_balance
- principal_component
= ending_balance
Across the full schedule:
sum(principal) ≈ original_principal
sum(interest) ≈ expected_total_interest
The schedule should end correctly.
final_balance == 0
// or, if high precision is preserved:
final_balance within accepted tolerance before final adjustment
Test period lengths that commonly expose assumptions:
For educational and debugging purposes, compare multiple strategies side by side:
The hardest part of implementing amortization is not always the formula.
Often, it is deciding which number is real. Is the real payment the high-precision result of the formula? The displayed two-decimal amount? The amount used to compute the next balance? The amount posted to a ledger? The amount expected by an external system?
Until those boundaries are explicit, two implementations can both look mathematically reasonable and still produce different schedules.
Equal payments are not just a mathematical property. They are a product promise implemented through precision rules, rounding boundaries, and source-of-truth decisions.
The formula matters. But the model around the formula matters just as much.
This exploration changed how I think about financial software.
At the beginning, it was easy to focus on the visible behavior: whether payments looked equal, whether the final payment drifted, whether 30/360 behaved differently from Actual/365.
But the more important lesson was underneath the numbers. A financial calculation is not only a calculation. It is a chain of decisions about representation, precision, timing, and truth. And once money enters the system, those decisions are no longer implementation details. They are the product.