[Quantproject-developers] QuantProject/b1_ADT/Statistics BasicFunctions.cs, 1.13, 1.14
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:13:24
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Statistics In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31854/Statistics Modified Files: BasicFunctions.cs Log Message: An exception now is thrown out, when the method GetVariance is invoked with less then two observations Index: BasicFunctions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Statistics/BasicFunctions.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** BasicFunctions.cs 11 May 2008 17:50:22 -0000 1.13 --- BasicFunctions.cs 27 Mar 2010 17:13:15 -0000 1.14 *************** *** 172,175 **** --- 172,177 ---- static public double GetVariance( ICollection data ) { + if ( data.Count < 2 ) + throw new Exception( "Variance requires at least 2 elements!" ); double simpleAverage = BasicFunctions.GetSimpleAverage(data); double sum = 0; |