Here is one algorithm, but n should fit in some type for it. Probably
long long
long long mean = 0;
long long sum = 0;
long long i;
for(i=0; i<n; i++)
{
sum += x[i];
while(sum >= n)
{
sum -= n;
mean++;
}
}
Kaloyan
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ralf
Krauss
Sent: Tuesday, August 05, 2003 10:46
To: Palm Developer Forum
Subject: calculate the mean(average) of numbers
Hi,
does anybody know, how to calculate the mean (average) of numbers if the
quantity of numbers is to high?
sum = x1 + x2 + x3 + ... + xn;
(with 'sum' and 'n' = very big, bigger as every type)
mean = sum/n;
Thanks
Ralf
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/