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.
Precision | Rounds | Notes |
---|---|---|
No rounding | 27506 | Crashes. |
100 | 27502 | Crashes. |
15 | 86 | |
10 | 58 | |
6 | 34 | The current display precision |
5 | 29 | |
2 | 10 | |
Election 2: 20 candidates, 4 seats (I think?), and 5000 votes.
Precision | Rounds | Notes |
---|---|---|
No rounding | 27518 | Crashes. |
100 | 27520 | Crashes. |
15 | 35 | |
10 | 26 | |
6 | 18 | The current display precision |
5 | 17 | |
2 | 11 | Only 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.