No description
Closed form of the constant-instalment recurrence, C*i / (1 - (1+i)^-n), with i the taux mensuel proportionnel (taux nominal / 12) rather than the taux actuariel equivalent, which is what French lenders use for the schedule. A zero rate is a real case, not a degenerate one: the PTZ is a 0 % loan and the denominator collapses to zero, which rust_decimal's Div panics on rather than erroring. The zero branch computes C/n, the limit of the formula as i tends to zero, and offre_c_ptz covers it. Both known-answer tests compare against generated fixtures whose values came from a real amortisation table, not from this implementation. The expect() is justified by the bounds from the previous commit: capital and rate cap the value well below i64::MAX cents, and rescale(2) makes the scale exact, so both EurosError arms are unreachable. CLAUDE.md is amended in the same commit to permit expect() only in this provable case, since the rule change exists for this call site. Requires rust_decimal's maths feature for powu. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|---|---|---|
| .claude/commands | ||
| crates | ||
| scripts | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CLAUDE.md | ||
| rust-toolchain.toml | ||