I am developing a poll using ruby, but the answer that i get is incorrect, i am looking for the answers that will results in 100% but my answers are sometimes 101% or 99% and i am sure is the rounding off of my floats but i just can get them right because without the rounding off the answers are very long floats. my code of calculating the results and displaying the results is
>
@general_poll_graph_data = generalsortedoptions.collect do |o|
option = [keys[count], (((o.poll_votes.count.to_f)/@general_poll.poll_votes.count.to_f)*100).round_to(1)]
count = count + 1
option
end