refactor(package): exported totals are exact or say so
The K-1 members' total row, the receipts index amount and the 1099 worksheet's payments text summed with a raw .sum(); they use kernel::total_of and print 'too large to compute' if a sum is past exact arithmetic (text::total_text), so an export of restored books never crashes. Unchanged text for every ordinary input. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7aa0cc68f3
commit
afc7c545da
3 files changed
+20
-15
No files matched your search
@@ -29,6 +29,13 @@ pub fn money(n: Decimal) -> String {
|
||||
n.to_string()
|
||||
}
|
||||
|
||||
/// A total as [`money`] prints it, or "too large to compute" when the sum
|
||||
/// of its figures was past exact arithmetic (`kernel::total` gave `None`):
|
||||
/// a printed total is exact or says so, and never crashes the export.
|
||||
pub fn total_text(total: Option<Decimal>) -> String {
|
||||
total.map_or_else(|| "too large to compute".to_string(), money)
|
||||
}
|
||||
|
||||
/// A member's share as the K-1 worksheet prints it: at least two places,
|
||||
/// however it was written ("50%", "0.5" and "0.500" all print "0.50"; a
|
||||
/// share of a third keeps its places). The printed text depends on the
|
||||
|
||||
Reference in new issue
Block a user