Unitshare

Method & worked examples

Round the shares.
Preserve the total.

Unitshare uses Hamilton's largest-remainder method for generic whole-item allocation. The method is simple to inspect, but its assumptions and tie rule matter.

Start with the ideal fractional shares

Let T be the number of whole items, and let each row have a nonnegative weight w. Sum the weights to get W. The ideal quota for row i is T × wᵢ ÷ W. These quotas add to T, but they may not be whole numbers. Rounding each quota independently can leave too many or too few items.

quotaᵢ = T × wᵢ / W
baseᵢ = floor(quotaᵢ)
remainderᵢ = quotaᵢ − baseᵢ
extra units = T − sum(baseᵢ)

Assign the base whole units first. Rank the exact fractional remainders from largest to smallest. Give one extra item to each of the first rows in that ranking until every item is allocated. A row receives either the floor or the ceiling of its quota; the resulting integers add exactly to T.

Example: 23 kit boxes, three shelves

Suppose the North, East and South shelves have demand weights 5, 3 and 2. W = 10. Their quotas are 23 × 5/10 = 23/2, 23 × 3/10 = 69/10 and 23 × 2/10 = 23/5. These are 11.5, 6.9 and 4.6 boxes.

The floors 11, 6 and 4 use 21 boxes. Two boxes remain. The fractional remainders are 1/2, 9/10 and 3/5, so East and South receive the extras. The final allocation is 11, 7 and 5, totalling 23. North's quota is largest, but its fractional remainder is smallest; extra units follow remainders, not the original weights.

Example: 17 seedling trays with decimal weights

Three growing areas have relative weights 1.5, 0.75 and 0.25. The sum is 2.5. Their quotas are 51/5, 51/10 and 17/10: 10.2, 5.1 and 1.7. Floors use 16 trays. The one remaining tray goes to the third row's 0.7 remainder, giving 10, 5 and 2.

Multiplying every weight by the same positive factor changes no quota. These inputs therefore give the same result as 6, 3 and 1. Weights do not have to add to 1 or 100.

Equal remainders use input order

For 2 units and three equal weights of 1, every quota is 2/3. All floors are zero and two units remain. This tool assigns them to rows 1 and 2, giving 1, 1 and 0. Put a different destination first and the exact tie outcome can change.

This is Unitshare's explicit deterministic tie rule. It is not presented as an official legal rule, a random draw or a judgement that earlier destinations deserve more. The table retains input order; the expandable list separately shows the remainder ranking. Add, remove or reorder your entries deliberately before relying on a tied result.

A larger total can reduce one share

Keep weights 5, 3 and 1 fixed. With T = 4, quotas are 20/9, 4/3 and 4/9. The floors are 2, 1 and 0; the last unit goes to the third row, producing 2, 1 and 1. With T = 5, quotas are 25/9, 5/3 and 5/9. The two extras now go to the first and second rows, producing 3, 2 and 0.

The third row loses an item when the total grows. This is an example of the largest-remainder method's non-monotonicity, often called the Alabama paradox in apportionment. Recalculate and inspect the entire result when changing the total. Do not treat a previous allocation as a guaranteed minimum in a later run.

Inputs and model limits

Exact arithmetic and local exports

The script reads decimal weights as scaled integers: six decimal places form one micro-weight scale. It uses integer numerators, division and remainders throughout. Since every row has the same denominator, remainder numerators can be compared directly, without rounded decimal sorting. The reduced fractions in the table describe those exact values.

Copy allocation and the text/JSON downloads include the current valid model, row order and tie rule. JSON integer and fraction quantities are strings to preserve exact values in software that reads the file. Downloads are generated in your browser, with no upload service. Editing to an invalid state clears the result and disables exports; Reset example reconstructs the initial three rows. A delayed clipboard response cannot restore a stale result as current.

Primary method references

The Congressional Research Service report, Appendix, printed page 22 describes floor quotas followed by descending fractional remainders. The U.S. Census Bureau's historical explanation describes the Hamilton/Vinton method and its total-size paradox. Its account also distinguishes the later equal-proportions method.

These sources ground the algorithm and limitation. Unitshare's row-order tie handling, input limits and practical examples are product choices, not copied statutory requirements. Use the calculator to inspect your own chosen weights.