RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Math.SumsAndSquares Function

Returns the sum of the values and the sum of the squared values in an array.

Pascal
procedure SumsAndSquares(const Data: array of Double; var Sum: Extended; var SumOfSquares: Extended);
C++
SumsAndSquares(const array of Double Data, Extended Sum, Extended SumOfSquares);

Math

SumsAndSquares returns the sum of the Data values in Sum and the sum of the squares in SumOfSquares. The data to sum is specified in the Data array parameter. In C++, Data_Size indicates the index of the last value (one less than the number of values in Data). 

This function is faster than calculating the sums separately. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!