After K-U10 made the kernel's Decimal sum exact or refused, the K-1 worksheet refused every split by thirds with "a member's tax-basis capital is too large to compute". Two tests caught it (thirds_summed_are_the_cents_they_are, a_running_split_never_drifts_a_cent); it never reached main, where the worksheet still called rust_decimal's own sum. A member's running total in RunningSplit is a sum of shares, each whole x weight / sum of weights: a quotient of 28 significant digits. Two thirds of 28 digits do not add to a number 96 bits hold. The total they stand for was never an exact figure, and INVARIANT 4 of that type was written for exactly that: the total is rounded to ten places before a cent is taken from it. So the fault was in the routing, not the arithmetic: K-U11a's script mapped that sum to the exact operation. A sum of rounded quotients is a rounded figure by construction, as a share's product is (checked_mul_rounded, K-U10). The kernel now names that sum too: Amount::checked_add_rounded and checked_sub_rounded, rust_decimal's own for Decimal and the plain operation for a machine integer. RunningSplit::split and unsplit call them and nothing else does; every sum of amounts stays exact or refused. So the K-1 worksheet computes what it computes on main, to the digit. The bridge property checks, over Decimal's whole range: the rounding sum is rust_decimal's figure to the digit and the scale, it is the exact figure wherever exact arithmetic gives one, and where it rounds it is within half a unit of the last place it keeps. The seed proptest shrank the failure to is kept. Every other place outside the kernel that makes a figure of more than ten places was read for the same fault (docs/proofs/k-u11.md lists them); none adds such a figure before rounding it. Co-Authored-By: Claude <noreply@anthropic.com>
9 lines
630 B
Plaintext
9 lines
630 B
Plaintext
# Seeds for failure cases proptest has generated in the past. It is
|
|
# automatically read and these particular cases re-run before any
|
|
# novel cases are generated.
|
|
#
|
|
# It is recommended to check this file in to source control so that
|
|
# everyone who runs the test benefits from these saved cases.
|
|
cc 56101dd675399c931df47369972f415782f4cd0e6ea874c37ef655b9961b69cb # shrinks to n = 2, splits = [(28343, [4, 2, 0, 0]), (27468, [0, 1, 0, 0]), (82432, [2, 4, 0, 0]), (-19139, [1, 2, 0, 0])]
|
|
cc 9d3652b30f1cf76da6d8dad78a402ff774ddf30ea760574a8c1ebed15e684684 # shrinks to n = 2, splits = [(1, [4, 2, 0, 0], 1), (990, [0, 1, 0, 0], 1)]
|