Page MenuHomePhabricator

Identify and implement a level of precision for STV elections
Open, Needs TriagePublic

Description

In T291821#9645629, @Driedmueller experimented with PHP precision while adjusting how STV elections are tallied in SecurePoll. The tl;dr is that, in some elections and contexts, no rounding (or rounding to a large number) results in a lot of rounds and an election that will potentially never actually tally.

In the data in T291821#9645629, some examples of different rounding numbers are provided. Below is a summary.

Election 1: 20 candidates, 7 seats, and 5000 votes.

PrecisionRoundsNotes
No rounding27506Crashes.
10027502Crashes.
1586
1058
634The current display precision
529
210

Election 2: 20 candidates, 4 seats (I think?), and 5000 votes.

PrecisionRoundsNotes
No rounding27518Crashes.
10027520Crashes.
1535
1026
618The current display precision
517
211Only elects 1 user. Might be fixed with T291821

This is of course only a problem with certain programming languages, including (sadly) PHP.

More precision means:

  • More "accurate" results - probably more difficult to test
  • Longer tallying times
  • More rounds (i.e. more difficult to read the results)

I would propose something in the "middle". 6 is the displayed precision but perhaps we should go for something more like 10, which seems to strike a better balance with accuracy and readability.