fix(viewer): percentages are Decimal, never f64

fmt::pct_change divided money amounts in f64 (a money path, AGENTS.md rule 1) and fmt::compact shortened amounts through f64; both are now Decimal via kernel::percent_of and round_display. profit::pct, the reports change and share columns follow the one percent rule: no percent of a zero or negative base (shown as nothing or an em dash). Every pages round_dp call goes through round_display; books' cent truncations keep their toward-zero leftover policy through kernel::round_places.

Co-Authored-By: Muse Wonder 1.0
This commit is contained in:
swaitsandMuse Wonder 1.0 committed 2026-11-09 18:54:24 -07:00
1 parent a414462be7
commit a7d0c7f2d3
8 files changed
+166 -54

No files matched your search

+2 -1
View File
@@ -788,7 +788,8 @@ pub fn build(dir: &Path, today: NaiveDate) -> Result<(), StoreError> {
let date = day(m, 1);
if in_range(date) {
let gross = rng.amount(450, 1600);
let fee = (gross * Decimal::new(10, 2)).round_dp(2) + Decimal::new(30, 2);
let fee =
crate::fmt::round_display(gross * Decimal::new(10, 2), 2) + Decimal::new(30, 2);
let net = gross - fee;
let e = s.create_entry(date, "Gumroad payout — template sales")?;
s.add_line(e, checking, Side::Debit, usd(net))?;