# property.rent-review
An index-linked rent review, the usual kind in a commercial lease: the rent
moves with an inflation index (CPI or RPI, or CPIH) between a base date and
the review date, often held between a **collar** (a minimum increase) and a
**cap** (a maximum), and often **upward-only** (it can never go down).
The caller supplies the two index values, in any integer unit as long as both
use the same one (CPI 128.4 and 133.9 can be 1284 and 1339). The function
never looks an index up: which month's figure counts, and which series, is a
term of the lease.
## How the rent is set
1. The index rent is passing rent × reviewIndex ÷ baseIndex.
2. If a cap is given and the index rises by more than the cap, the rent is
passing rent × (1 + cap).
3. Else, if a collar is given and the index rises by less than the collar
(or falls), the rent is passing rent × (1 + collar).
4. If upward-only and the result would be below the passing rent, the rent
stays at the passing rent.
`appliedBy` says which of these set the rent (`index` when the index lands
exactly on the cap or collar). Every comparison is made on exact fractions,
and the rent is rounded half-up to the penny once, at the end. The index
movement in basis points is returned for display only: applying a rounded
percentage (6.42% for a 6.4166…% rise) gives a different rent from applying
the index itself, and it is the index that the lease applies.
## Collar and cap are for the whole period
The collar and cap are the total increase allowed over the review period, not
a yearly rate. A lease that says "between 1% and 4% a year, compounded, over
five years" has a collar of (1.01^5 − 1) = 5.10% and a cap of (1.04^5 − 1) =
21.67%; work those out as the lease specifies (it may say how to round them)
and pass the totals.
## Edge cases
- A collar above the cap is an error. A negative collar (a maximum fall) is
allowed; so is a collar with no cap and a cap with no collar.
- Upward-only with a falling index and no collar leaves the rent unchanged.
- Leases that round the reviewed rent to the nearest pound, or to a multiple
of £50, need that rounding applied to `newRent` afterwards.
## Limits
Passing rent up to £10,000,000 (1,000,000,000 minor units), indices from 1 to
1,000,000, collar and cap from −9,999 to 100,000 basis points, which keeps all
the arithmetic exact in every language.