-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: use a transaction's amount precisions when balancing it
Surprising developments in old behaviour, as a consequence of #931: now that print shows amounts with all of their decimal places, we had better balance transactions using all of those visible digits (so that hledger and a user will agree on whether it's balanced). So now when transaction balancing compares amounts to see if they look equal, it uses (for each commodity) the maximum precision seen in just that transaction's amounts - not the precision from the journal's commodity display styles. This makes it more localised, which is a nice simplification. In journalFinalise, applying commodity display styles to the journal's amounts is now done as a final step (after transaction balancing, not before), and only once (rather than twice when auto postings are enabled), and seems slightly more thorough (affecting some inferred amounts where it didn't before). Inferred unit transaction prices (which arise in a two-commodity transaction with 3+ postings, and can be seen with print -x) may now be generated with a different number of decimal places than before. Specifically, it will be the sum of the the number of decimal places in the amounts being converted to and from. (Whereas before, it was.. some other, perhaps larger number.) Hopefully this will always be a suitable number of digits such that hledger's & users' calculation of balancedness will agree. Lib changes: Hledger.Data.Journal added: journalInferCommodityStyles journalInferAndApplyCommodityStyles removed: canonicalStyleFrom
- Loading branch information
1 parent
2fa60bb
commit e17ef86
Showing
7 changed files
with
192 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.