I am trying to accurately calculate percentages with perl. The problem is of course that percentages don't end up as nice, even whole numbers...and I want to truncate those number (92.38495%) to the whole number accurately reflecting the percentage (92%). Using "($value/$total)*100" gives the percentages, then I used "$value=int($value+0.5)" to round it up or down. The problem is that all the percentages should equal 100 (duh), but sometimes, after being rounded, they DON'T! Sometimes it's 101, sometimes 99, etc. How can I round these numbers off so that they are accurate in equaling 100?
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.