A $1,000.01 HOA project has three equally liable units. Rounding each share to $333.34 yields $1,000.02. The allocation that balances is $333.34, $333.34, and $333.33. Applying $100.01 in reserves then leaves exactly $300.00 for each unit.
| Unit | Gross allocation | Reserve credit | Owner assessment |
|---|---|---|---|
| 1A | $333.34 | $33.34 | $300.00 |
| 1B | $333.34 | $33.34 | $300.00 |
| 2A | $333.33 | $33.33 | $300.00 |
| Total | $1,000.01 | $100.01 | $900.00 |
Reconcile both funding sources
Give each unit a weight of one for equal allocation. For an undivided common-element share, use its exact ownership percentage. For square-footage allocation, use the stated floor area. If a condo declaration gives shares of 12.5%, 37.5%, and 50%, a $100.01 assessment allocates $12.50, $37.50, and $50.01.
For each unit, multiply the budget in cents by its weight. Divide by the sum of all weights to get a whole-cent quota and a remainder. Give the leftover cents to the highest remainders, with input order breaking ties. Scaled integer weights and BigInt intermediates preserve the ordering when a product exceeds the safe integer range.
With a reserve contribution, run largest remainder again using each unit's gross cents as the weight. Every reserve credit is then bounded by the corresponding gross assessment. The project ledger records both funding sources, so a reader can reconcile gross charges, reserves, and owner collections independently.
Compare payment terms on the same balance
On a $1,000.00 net assessment, a 5% upfront discount leaves $950.00 due. Three installments at 12% nominal annual interest accrue 1% on the opening balance each month. Rounding each month's interest half up gives payments of $340.03, $340.03, and $340.01. Interest totals $20.07 and the last balance is zero.
Late fees are a separate calculation on the overdue amount. With a five-day grace period, an unpaid installment has no fee on day five. Day six applies the configured flat and percentage charges, subject to the cap.
Benchmark exact splits and monthly schedules
Run from the source checkout with Node.js 20 or later. The four fixtures exercise equal allocation, percentage interest with a second allocation for reserves, square footage, and a 12-month payment plan. The timed loop includes input validation and result creation. The inputs are prebuilt and the assertions run outside the timed loop. MIT source repository
node --input-type=module <<'JS' import assert from 'node:assert/strict'; import { performance } from 'node:perf_hooks'; import { allocateAssessment, assessLateFee, quoteAssessmentPayment } from './src/index.js'; const equal = { budgetCents: 100_001, reserveCents: 10_001, units: ['1A', '1B', '2A'].map((id) => ({ id })), }; const units = Array.from({ length: 100 }, (_, index) => ({ id: `U${index + 1}`, interestPercent: index < 50 ? '0.75' : '1.25', squareFeet: `${750 + index * 11}.5`, })); const interest = { budgetCents: 1_200_001, reserveCents: 123_456, method: 'percentage-interest', units, }; const area = { ...interest, method: 'square-footage', reserveCents: 0 }; const payments = { ...equal, units: units.slice(0, 12), paymentPlan: { months: 12, annualRateBps: 600, discountBps: 500 }, }; const fixtures = [ ['equal + reserves / 3 units', equal, 20_000], ['interest + reserves / 100 units', interest, 3000], ['area / 100 units', area, 3000], ['payment plans / 12 units', payments, 1200], ]; assert.equal(3 * Math.round(equal.budgetCents / 3), 100_002); assert.deepEqual(allocateAssessment(equal).units.map((row) => row.assessmentCents), [30_000, 30_000, 30_000]); const quote = quoteAssessmentPayment(100_000, { months: 3, annualRateBps: 1200, discountBps: 500 }); assert.equal(quote.lumpSum.dueCents, 95_000); assert.deepEqual(quote.installments.schedule.map((row) => row.paymentCents), [34_003, 34_003, 34_001]); const policy = { graceDays: 5, flatFeeCents: 300, rateBps: 100, capCents: 500 }; assert.equal(assessLateFee({ daysLate: 5, overdueCents: 34_003 }, policy), 0); assert.equal(assessLateFee({ daysLate: 6, overdueCents: 34_003 }, policy), 500); const measurements = []; for (const [fixture, input, iterations] of fixtures) { const result = allocateAssessment(input); const sum = (field) => result.units.reduce((total, row) => total + row[field], 0); assert.equal(sum('grossCents'), input.budgetCents); assert.equal(sum('reserveOffsetCents'), input.reserveCents); assert.equal(sum('assessmentCents'), input.budgetCents - input.reserveCents); for (const unit of result.units) { assert.equal(unit.grossCents, unit.reserveOffsetCents + unit.assessmentCents); if (unit.paymentPlan) { const { schedule } = unit.paymentPlan.installments; assert.equal(schedule.reduce((total, row) => total + row.principalCents, 0), unit.assessmentCents); assert.equal(schedule.at(-1).balanceCents, 0); } } for (let i = 0; i < 600; i++) allocateAssessment(input); const samples = []; for (let sample = 0; sample < 5; sample++) { let checksum = 0; const start = performance.now(); for (let i = 0; i < iterations; i++) { const allocation = allocateAssessment(input); checksum += allocation.units[0].paymentPlan?.installments.totalCents ?? allocation.units[0].assessmentCents; } samples.push(performance.now() - start); const first = result.units[0]; const expected = first.paymentPlan?.installments.totalCents ?? first.assessmentCents; assert.equal(checksum, expected * iterations); } const median = samples.sort((a, b) => a - b)[2]; measurements.push({ fixture, iterations, medianMs: Number(median.toFixed(2)), callsPerSecond: Math.round(1000 * iterations / median) }); } console.log(process.version, process.platform, process.arch); console.table(measurements); JS One run on arm64 macOS with Node.js v24.14.1 produced these medians over five samples.
| Fixture | Calls per sample | Median | Calls per second |
|---|---|---|---|
| Equal with reserves, 3 units | 20,000 | 18.82 ms | 1,062,927 |
| Percentage interest with reserves, 100 units | 3,000 | 96.11 ms | 31,215 |
| Square footage, 100 units | 3,000 | 101.46 ms | 29,569 |
| Monthly plans, 12 units | 1,200 | 27.74 ms | 43,263 |
Largest remainder needs one pass over the weights and may need a sort, giving O(n log n) worst-case work per allocation. The reserve fixture may sort twice. Monthly quotes add per-unit schedule generation and, when interest is positive, a search over whole-cent payment sizes. Benchmark that option independently if a caller only needs some units' schedules.
Try the allocation methods and inspect the monthly rows for one unit in the GitHub Pages demo. Related tools include the HOA Special Assessment Calculator and CAM Reconciliation Calculator.