StdDeviation overflow?
Posted: Tue Apr 07, 2009 9:08 am
Hello,
if i have a lot of big values and will calculate the standard deviation the function will result in wrong values. I think the function have an overflow, in that case it would be nice if the value is set to double.nan or something so that i can recalculate it or change the source.
Example:
Thanks!
if i have a lot of big values and will calculate the standard deviation the function will result in wrong values. I think the function have an overflow, in that case it would be nice if the value is set to double.nan or something so that i can recalculate it or change the source.
Example:
Code: Select all
Steema.TeeChart.Styles.FastLine ser = new Steema.TeeChart.Styles.FastLine();
Steema.TeeChart.Styles.FastLine stddev = new Steema.TeeChart.Styles.FastLine();
Steema.TeeChart.Functions.StdDeviation func = new Steema.TeeChart.Functions.StdDeviation();
stddev.Function = func;
Random ran = new Random();
// 30,000 work -> stddev = 1,200,000,000
// 400,000 do not work -> stddev = 14,000,000,000 (overflow?)
for (int i = 0; i < 400000; i++)
{
ser.Add(ran.Next(-2000000000, 2000000000));
}
stddev.DataSource = ser;
tChart1.Series.Add(ser);
tChart1.Series.Add(stddev);