Election Seat Calculator
This simple election calculator computes the number of seats won by a political party in a parliamentary election. It uses the *D'Hondt*'s electoral system where the votes of only those political parties that receive at least a threshold percentage of the valid votes are taken into account.
For example, if parties, A, B, C, D, and E participate in the election and
receive 40%, 30%, 18% , 8%, and 4% of the votes in an election region that is slated to have 8 seats in the parliament and there is a 10%
threshold then the following simple computation is carried out: The votes of A, B, and C are divided by 1, 2, 3,...,8 and the highest
eight counts of votes win the eight seats. (Parties D and E do not win any seats because of the 10% threshold.)
Here is how the calculator works:
1. Enter the number of seats to be contested.
2. Enter the votes of the parties in whole numbers such as 2345, 120, 5672, 934562 without using any spaces or commas into the text fields
across the party amblems.
3. Enter the threshold, if any, as a percentage. You can enter any number between 0 and 100. This should be useful when you want to exclude
a particular party with the least percentage of votes from winning any seats. You can also enter 0 in the number of votes row for any
particular party that falls below the required threshold. That is, if you would like to assume that a party gathers less than the
threshold over all the election districts then you should enter 0 in an estimation of the number of seats for that party in any district.
Note: In some pathological cases, the number of seats may be distributed unevently. For example, all five parties receive 20% of the
votes, but there are only 4 seats to be won. In such a case one party goes without a seat. The implementation of Dhondt's algorithm is
simplified to avoid excessive use of memory, especially when there are too many seats. Thus, rather than computing all the quotients of
the numbers of votes by 1,2,3, etc., this is done gradually and selectively, and this way, the size of the arrays is limited to the number
of parties rather than the number of seats that is generally greater than the number of parties.