1
$\begingroup$

So, for a site that a friend is developing, we need to work with a legacy plugin that counts votes as either positive or negative totals, but doesn't already provide an absolute total. We can, however, get the percentage out of the plugin. So my question is: using the percentage, and either the positive or negative vote total, can we get the absolute total of votes cast on a particular item?

  • 0
    Can you give a *numerical* example, of what is given (known) and what is to be computed?2012-07-14
  • 0
    Sure - for example, there's an item with +4 positive votes, and the percentage on the items is 57%. How many votes have been cast, in total, to get that percentage? (Roughly - it doesn't have to be terribly exact.)2012-07-14
  • 0
    There is a problem if we are at $0$. Then we get the useless further information of $50\%$, and the number of votes can't be determined. Otherwise, things are in principle OK. The only problem is numerical instability when number of votes is large, but the $\pm$ is tiny. If we are "tracking" it could be worthwhile to do some averaging.2012-07-14
  • 0
    Using the first of my formulae you get $100 \times \frac{4}{57} = 7.0175\ldots$ and indeed $4$ is about 57.1% of $7$.2012-07-14

1 Answers 1

1

If $P$ the number of positive votes, $N$ the negative votes, $T=P+N$ the total, $p=100 \times \frac{P}{T}$ the positive percentage and $n=100 \times \frac{N}{T}$ the negative percentage then you can use any of $$T=100 \times \frac{P}{p} =100 \times \frac{N}{n} =100 \times \frac{P}{100-n} =100 \times \frac{N}{100-p}$$ so long as the denominator is not $0$.

  • 0
    Most excellent, thank you! I just needed an example to go by.2012-07-14