Forum Moderators: coopster & phranque

Message Too Old, No Replies

Odd averages

I need help!

         

adni18

9:39 pm on Sep 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a rating thingy on my website for each of my images in my image gallery. They are based on a scale from 1 to 10. Each time a user votes for an image, it adds it to the grand average and divides them all by the number of votes there have been. Here's the problem: every time someone votes, the grand average goes down to 0.846346937649367494694837494873. Someone please help!

coopster

9:47 pm on Sep 30, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are you stating that the same number comes up all the time? Or that the average is decreasing?

adni18

10:51 pm on Sep 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Never mind. I figured it out. Thanx though!

upside

7:58 am on Oct 1, 2004 (gmt 0)

10+ Year Member



adni18, what did you end up doing? I would probably use something like:


use Math::Round;
$rounded = nearest(1, (0.846346937649367494694837494873);

adni18

11:21 am on Oct 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, I figured out I was adding to the GRAND AVERAGE then dividing. I needed to save THE TOTAL NUMBER OF POINTS then display the average by dividing it by the number of votes.