Repository navigation
Extend the per-unit cost rounding allowance to the automated check - #13
Merged
Merged
Conversation
The extended balance test that follows the generated postings of an automated transaction weighed each candidate's residual against the zero test alone, without the per-unit cost rounding allowance that C++ adds before its balance test (xact.cc:908-929): the exact adjustment of rounding each per-unit cost of a real posting at its price's decimals, which the engine models, in `balancePool` as in this check, as half a unit in the last place of every cost in the commodity written with decimals. A balanced automated rule that adds to both balancing groups of regress/3314_rounding_auto (issues 3314 and 1125, each group carrying 0.50 bread @ $3.99 and 1.50 bread @ $4.99 against $-9.49) left a residual of half a cent that the zero test refuses and that the allowance absorbs, so the merged oracle rejected a journal that C++ (5f9855cef, with PR 3317) accepts with the rows `2.00 bread Budget:Bread` and `2.00 bread Expenses:Bread` and that main's oracle (bbd5478) accepts as well. The pre-merge branch engine rejected it too, so the conflict resolution had kept the branch's gap rather than main's behavior. The check now allows the sum of the per-cost allowances of the matched postings and of those generated so far, beside the zero test, as `balancePool` allows it beside its own tests. Witness: regress/3314_rounding_auto prints the four rows of main's oracle, and the C++ binary prints the two rows its test expects; the whole witness set of the previous commit (35 files) still prints identically to main's oracle. Co-Authored-By: GLM (Z.ai) via pi <noreply@z.ai> Pi-Session: 01a163ec-1792677793
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #12. The extended balance test after an automated transaction's generated postings refused regress/3314_rounding_auto (issues #3314, #1125): a balanced rule adding to both balancing groups leaves a half-cent residual that the zero test refuses and that the per-unit cost rounding allowance of C++ (xact.cc:908-929, PR 3317) absorbs. The pre-merge branch engine rejected the file too, so the conflict resolution had kept the branch's gap.
This commit gives the check the same allowance
balancePoolstates, over the matched postings and those generated so far, beside the zero test.Witness: regress/3314_rounding_auto prints the four rows of main's oracle; the C++ main binary (5f9855cef) prints the two rows its test expects; the whole 35-file witness set of the previous commit still prints identically to main's oracle.