[Jspro-cvs] jsPro/arrays Array.js,NONE,1.1
Brought to you by:
wigleys
|
From: Stuart W. <wi...@us...> - 2005-02-22 11:22:27
|
Update of /cvsroot/jspro/jsPro/arrays In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28755/arrays Added Files: Array.js Log Message: no message --- NEW FILE: Array.js --- /** * +--------------------------------------------------------------------------+ * | jsPro - Array | * +--------------------------------------------------------------------------+ * | Copyright (C) 2001-2005 Stuart Wigley | * +--------------------------------------------------------------------------+ * | This library is free software; you can redistribute it and/or modify it | * | under the terms of the GNU Lesser General Public License as published by | * | the Free Software Foundation; either version 2.1 of the License, or (at | * | your option) any later version. | * | | * | This library is distributed in the hope that it will be useful, but | * | WITHOUT ANY WARRANTY; without even the implied warranty of | * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | * | General Public License for more details. | * | | * | You should have received a copy of the GNU Lesser General Public License | * | along with this library; if not, write to the Free Software Foundation, | * | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | [...1285 lines suppressed...] for (var i = iStart; i < iEnd; i++) { if (typeof this[i] == 'number') { fSum += Math.pow((this[i] - fMean), 2); iCount++; } } if (iCount == 1) { throw vError = new UnknownException('Array.variance'); } var fVariance = (iCount == 0) ? null : fSum / (iCount - 1); } catch (vError) { if (vError instanceof Error) { vError.handleError(); } } finally { return vError ? null : fVariance; } } |