These are not official results or official code. There are many reasons why the official results may end up differently, some of which are listed below. This is provided with no warranty.
This is a computer program, and like all computer programs, it probably contains errors. Errors either in my program or in the electoral commission's program could cause their results to be different. Similarly an incorrect understanding of the law, either by me or the appropriate electoral commission could cause a different result. There is no a priori reason to trust either, but having more than one available makes checking possible (and generally I have found agreement with exceptions listed below). One can also compare with other programs that do the same job like Grahame Bowland's program. These problems are particularly likely to come up in untested scenarios, such as the legal question of whether a party is eligible for above the line votes if all but one of their candidates are disqualified. Similarly, if a formal vote requires a certain number of numbers to be filled in, and one of those candidates ends up excluded, is it still a formal vote? Does a vote contribute to setting the quota if the first person voted for is excluded? I am not a lawyer.
Hackers may infiltrate or intercept the process, and change either my results or an electoral commission's result.
In some elections, there are ties, such as for the candidate with the lowest tally who should be excluded. Such ties are resolved in a variety of manners. For the federal senate, the AEC is given discretion. This is sometimes done randomly. I generally cannot accurately pick this. It is unlikely to make a difference in practice, but certainly could.
In NSW state elections (not the NSW senators in the federal senate), rather than dealing with fractional votes in surplus redistribution, a random sampling of ballots is used. I cannot predict this, and the NSW EC does not make their method of choosing votes public. This frequently changes the election outcome in close local NSW elections.
The federal senate counting legislation is generally well written and simple. However there was a recent innovation to make things easier by allowing multiple simultaneous exclusions. (Commonwealth Electoral Act 1918, Section 273, subsections 13A and 13AA). The legislation was designed to do this only when it would not affect the outcome, but errors in the legislation and inherent problems with rounding mean that it can actually affect the outcome, although it is somewhat unlikely. Complicating matters is that it is not clear to me (I am not a lawyer) whether it is compulsory to use section 13A. The AEC claimed that it was voluntary and that it did not change the results. The latter is mathematically incorrect, but I am not a lawyer and cannot comment on the former legal issues. Incidentally, I think 13A and 13AA should be removed - they gain nothing useful, make the counting algorithm about twice as complex (and therefore bug prone) as without them, and potentially lead to a very interesting political situation if the two different methods of counting actually produced different candidates elected. Nevertheless I have implemented it as it is in the legislation. In 2013, the AEC used this, but in 2016 they decided not to use it.
In the 2013 election, my algorithm produced a vote tally one different (30922 vs 30921) in step 228 of the SA count to the posted results. This had no impact on who was elected. I checked the results very carefully in multiple manners and could not see an error in my count. I re-downloaded the raw data files and got the same result. Possibly there was an error in the transmission of the data files between the AEC count and placing the list of votes on the website (such rare errors do happen, computers are not perfectly reliable). Perhaps I made an error. Other states were exactly the same as my algorithm for each tally
In the 2016 election, my algorithm produced slightly different tallys as the AEC did not implement subsections 13A and 13AA as described earlier,but it did not alter who was elected.
One can continue counting after the appropriate number of senators have already been elected in some situations, although this seems contra indicated by subsection 18, Notwithstanding any other provision of this section, where the number of continuing candidates is equal to the number of remaining unfilled vacancies, those candidates shall be elected.. In 2016, the AEC seems to not apply this rule if there is an exclusion to finish or a surplus to redistribute, even if there is only one candidate left in the running. This by definition cannot change the outcome of the election, but can alter the presentation of the final counts and conceivably the order of election. It is a matter of supreme unimportance. I believe the AEC changed their handling of this between 2013 and 2016, and my algorithm uses by default the 2013 presentation which does not do this questionable continuation.
If I explicitly disable sections (13A), (13AA) and (18) of the legislation as described above, then I get exactly the same tallys for all candidates for all counts for all states for the 2016 federal elections.
The 2019 election was similar to the 2016 election in that I got exactly the same tallys for all candidates for all counts if I disabled multiple exclusions and did a similar (but opposite) modification to the when-do-I-stop, this time stopping an exclusion before any votes are actually transferred if the number of continuing candidates equals the number of unfilled seats. As in 2016 the multiple exclusions could in principle change who is elected (but didn't in this particular year), while the exact point where one stops counting can't affect who is elected.