Talk:Cumulative standard deviation

From Rosetta Code
Revision as of 23:23, 16 June 2009 by rosettacode>ShinTakezou (→‎n is always >0: it can be 0, indeed)

n is always >0

But several examples check for n ==0. I don't think it is necessary in this task (but won't hurt). --Paddy3118 22:06, 16 June 2009 (UTC)

Not at all both: it won't hurt, and n is not always > 0. All the code I've done, and even the rest for what I can understand, provide a way of calculating standard deviation and mean, even if the first datum was not injected yet. A smart user won't call the method/function to get the mean if s/he's not put at least one value, but a dummy user could. In the OO cases, some methods shouldn't be public, and standard deviation could not be requested without adding a new value (very odd!), i.e. the only way to get stddev should be adding a new value... so that it would be a "know once and then forget" function/object. So to me it was "natural" to check for n>0, letting the user call mean, variance or whatever also if s/he's not added any value at all, without causing a division by zero problem. --ShinTakezou 23:23, 16 June 2009 (UTC)