File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 66 Idx: Integer;
77begin
88 if (System.Length(A) = 0) then
9- raise SysUtils.EArgumentException.Create('Array is empty');
9+ raise SysUtils.EArgumentException.Create('Array of weights is empty');
1010 WeightSum := 0.0;
1111 for Weight in A do
1212 begin
1313 if Math.Sign(Weight) = Math.NegativeValue then
1414 raise SysUtils.EArgumentException.Create(
15- 'All array elements must be non-negative'
15+ 'All weights must be non-negative'
1616 );
1717 WeightSum := WeightSum + Weight;
1818 end;
1919 if Math.IsZero(WeightSum) then
20- raise SysUtils.EArgumentException.Create('Sum of array elements is zero');
20+ raise SysUtils.EArgumentException.Create('Sum of weights is zero');
2121 System.SetLength(Result, System.Length(A));
2222 for Idx := 0 to Pred(System.Length(A)) do
2323 Result[Idx] := A[Idx] / WeightSum;
Original file line number Diff line number Diff line change 66 Idx: Integer;
77begin
88 if (System.Length(A) = 0) then
9- raise SysUtils.EArgumentException.Create('Array is empty');
9+ raise SysUtils.EArgumentException.Create('Array of weights is empty');
1010 WeightSum := 0;
1111 for Weight in A do
1212 WeightSum := WeightSum + Weight;
1313 if WeightSum = 0 then
14- raise SysUtils.EArgumentException.Create('Sum of array elements is zero');
14+ raise SysUtils.EArgumentException.Create('Sum of weights is zero');
1515 System.SetLength(Result, System.Length(A));
1616 for Idx := 0 to Pred(System.Length(A)) do
1717 Result[Idx] := A[Idx] / WeightSum;
You can’t perform that action at this time.
0 commit comments