fix(core): a tie between shares goes to the earlier part, exactly (held for the owner's decision)
split_by_weights_into's largest-remainder policy ranked the leftover cents by the rounded quotient's remainder (Decimal keeps 28 significant digits), so an exact tie was decided by the quotient's last digit, not given to the earlier part as apportion's docs and bookspec's Lean model (Apportion.lean: remW = x*w % W, ties to the earlier member) say. 20.00 by 4/1/1 over 6 gave 13.33, 3.34, 3.33 where the exact tie of remainders (0.02 over 6 each) belongs to the first: 13.34, 3.33, 3.33. It now ranks the exact integer remainder whole x weight - part x total (the quantity share_floor_with returns), sign-flipped for a negative total so the order stays the share's own. The parts still sum to the whole and each is within one step; only which part takes a tied cent changes. Stored entries never move (posted is forever); a report recomputed for a past period can move a cent between parties. The finding test is flipped into the law (ties_go_to_the_earlier_part), the bridge's ranking property now includes ties, and the spec block, k-u3.md and verification.md say ties go to the earlier part, exactly. This branch is held: the owner decides whether the cents may move (see tests/kernel_bridge/ties.rs for what it moves). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4da1c5b30f
commit
294cb99a58
5 files changed
+112
-96
No files matched your search
@@ -34,9 +34,8 @@
|
||||
//! it) is shared among the members credited in proportion to their
|
||||
//! credits, to the base currency's minor unit (cents, whole yen),
|
||||
//! leftover units by largest remainder
|
||||
//! (kernel::apportion, a tie in the rounded remainders to the
|
||||
//! earlier member; an exact tie follows the quotient's 28th digit,
|
||||
//! K-U10): each takes at
|
||||
//! (kernel::apportion over the exact remainders, a tie to the
|
||||
//! earlier member, K-U10): each takes at
|
||||
//! most its own credit, and the split depends on the order the
|
||||
//! members are given only for a tied leftover cent (never on line
|
||||
//! order). Joint property is joint (BS-partner-1's
|
||||
|
||||
Reference in new issue
Block a user