refactor(package): Decimal arithmetic goes through the kernel (K-U12)

The raw-decimal-arith detector counted 13 places in ledger-package
before and counts 0 after. No figure changes.

Negations go through money::neg; the two differences of books figures
(attention, k1_tax) through sub_in_range; the checked sums in the
attention checks through Amount::checked_add / checked_sub with their
"cannot compute" handling untouched.

Not a plain sum or sign: text.rs padded a number to two places with
rescale (which rounds when 96 bits do not hold the padded digits); it
now uses rescale_exact and keeps the number as it was if padding would
round, so the printed text never rounds.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude committed 2026-11-09 23:57:22 -07:00
1 parent 0fb19b4b25
commit 5ef5f47ebf
5 files changed
+17 -13

No files matched your search

+1 -1
View File
@@ -268,7 +268,7 @@ fn notes_for(ledger: &Ledger, r: &ledger_core::Vendor1099Report) -> Vec<String>
for p in &r.other_receipts {
// Money in is negative; its reversal gives it back.
let what = if p.amount < Decimal::ZERO {
format!("received {} from", money(-p.amount))
format!("received {} from", money(ledger_core::money::neg(p.amount)))
} else {
format!("reversed {} received from", money(p.amount))
};