2026-07-29 20:30:55 +02:00
|
|
|
[package]
|
|
|
|
|
name = "immo-core"
|
|
|
|
|
version = "0.1.0"
|
|
|
|
|
edition.workspace = true
|
|
|
|
|
rust-version.workspace = true
|
|
|
|
|
|
|
|
|
|
[dependencies]
|
Add LoanOffer::monthly_repayment
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>
2026-08-23 16:26:55 +02:00
|
|
|
rust_decimal = { version = "1.42.1", features = ["maths"] }
|
2026-07-30 15:09:49 +02:00
|
|
|
thiserror = "2.0.19"
|
2026-07-30 11:22:41 +02:00
|
|
|
|
|
|
|
|
[lints.clippy]
|
|
|
|
|
inconsistent_digit_grouping = "allow"
|