Bugfix: (bnr) Work item 17501 - =sumproduct(A,B) <> =sumproduct(B,A) in xlsx

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@87695 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2012-03-12 23:42:12 +00:00
parent 4bb4f5ebc8
commit 4f76dfad97
3 changed files with 42 additions and 28 deletions

View File

@ -144,7 +144,7 @@ class PHPExcel_Calculation_MathTrig {
* COMBIN
*
* Returns the number of combinations for a given number of items. Use COMBIN to
* determine the total possible number of groups for a given number of items.
* determine the total possible number of groups for a given number of items.
*
* @param int $numObjs Number of different objects
* @param int $numInSet Number of objects in each combination
@ -920,7 +920,7 @@ class PHPExcel_Calculation_MathTrig {
* SIGN
*
* Determines the sign of a number. Returns 1 if the number is positive, zero (0)
* if the number is 0, and -1 if the number is negative.
* if the number is 0, and -1 if the number is negative.
*
* @param float $number Number to round
* @return int sign value
@ -1090,7 +1090,12 @@ class PHPExcel_Calculation_MathTrig {
/**
* SUMPRODUCT
*
* @param mixed $value Value to check
* Excel Function:
* SUMPRODUCT(value1[,value2[, ...]])
*
* @access public
* @category Mathematical and Trigonometric Functions
* @param mixed $arg,... Data values
* @return float
*/
public static function SUMPRODUCT() {
@ -1099,6 +1104,12 @@ class PHPExcel_Calculation_MathTrig {
$wrkArray = PHPExcel_Calculation_Functions::flattenArray(array_shift($arrayList));
$wrkCellCount = count($wrkArray);
for ($i=0; $i< $wrkCellCount; ++$i) {
if ((!is_numeric($wrkArray[$i])) || (is_string($wrkArray[$i]))) {
$wrkArray[$i] = 0;
}
}
foreach($arrayList as $matrixData) {
$array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData);
$count = count($array2);
@ -1107,10 +1118,10 @@ class PHPExcel_Calculation_MathTrig {
}
foreach ($array2 as $i => $val) {
if (((is_numeric($wrkArray[$i])) && (!is_string($wrkArray[$i]))) &&
((is_numeric($val)) && (!is_string($val)))) {
$wrkArray[$i] *= $val;
if ((!is_numeric($val)) || (is_string($val))) {
$val = 0;
}
$wrkArray[$i] *= $val;
}
}

View File

@ -960,10 +960,10 @@ class PHPExcel_Calculation_Statistical {
* BINOMDIST
*
* Returns the individual term binomial distribution probability. Use BINOMDIST in problems with
* a fixed number of tests or trials, when the outcomes of any trial are only success or failure,
* when trials are independent, and when the probability of success is constant throughout the
* experiment. For example, BINOMDIST can calculate the probability that two of the next three
* babies born are male.
* a fixed number of tests or trials, when the outcomes of any trial are only success or failure,
* when trials are independent, and when the probability of success is constant throughout the
* experiment. For example, BINOMDIST can calculate the probability that two of the next three
* babies born are male.
*
* @param float $value Number of successes in trials
* @param float $trials Number of trials
@ -1309,7 +1309,7 @@ class PHPExcel_Calculation_Statistical {
* CRITBINOM
*
* Returns the smallest value for which the cumulative binomial distribution is greater
* than or equal to a criterion value
* than or equal to a criterion value
*
* See http://support.microsoft.com/kb/828117/ for details of the algorithm used
*
@ -1467,9 +1467,9 @@ class PHPExcel_Calculation_Statistical {
/**
* EXPONDIST
*
* Returns the exponential distribution. Use EXPONDIST to model the time between events,
* such as how long an automated bank teller takes to deliver cash. For example, you can
* use EXPONDIST to determine the probability that the process takes at most 1 minute.
* Returns the exponential distribution. Use EXPONDIST to model the time between events,
* such as how long an automated bank teller takes to deliver cash. For example, you can
* use EXPONDIST to determine the probability that the process takes at most 1 minute.
*
* @param float $value Value of the function
* @param float $lambda The parameter value
@ -1501,8 +1501,8 @@ class PHPExcel_Calculation_Statistical {
* FISHER
*
* Returns the Fisher transformation at x. This transformation produces a function that
* is normally distributed rather than skewed. Use this function to perform hypothesis
* testing on the correlation coefficient.
* is normally distributed rather than skewed. Use this function to perform hypothesis
* testing on the correlation coefficient.
*
* @param float $value
* @return float
@ -1524,8 +1524,8 @@ class PHPExcel_Calculation_Statistical {
* FISHERINV
*
* Returns the inverse of the Fisher transformation. Use this transformation when
* analyzing correlations between ranges or arrays of data. If y = FISHER(x), then
* FISHERINV(y) = x.
* analyzing correlations between ranges or arrays of data. If y = FISHER(x), then
* FISHERINV(y) = x.
*
* @param float $value
* @return float
@ -2460,10 +2460,10 @@ class PHPExcel_Calculation_Statistical {
* NEGBINOMDIST
*
* Returns the negative binomial distribution. NEGBINOMDIST returns the probability that
* there will be number_f failures before the number_s-th success, when the constant
* probability of a success is probability_s. This function is similar to the binomial
* distribution, except that the number of successes is fixed, and the number of trials is
* variable. Like the binomial, trials are assumed to be independent.
* there will be number_f failures before the number_s-th success, when the constant
* probability of a success is probability_s. This function is similar to the binomial
* distribution, except that the number of successes is fixed, and the number of trials is
* variable. Like the binomial, trials are assumed to be independent.
*
* @param float $failures Number of Failures
* @param float $successes Threshold number of Successes
@ -2688,10 +2688,10 @@ class PHPExcel_Calculation_Statistical {
* PERMUT
*
* Returns the number of permutations for a given number of objects that can be
* selected from number objects. A permutation is any set or subset of objects or
* events where internal order is significant. Permutations are different from
* combinations, for which the internal order is not significant. Use this function
* for lottery-style probability calculations.
* selected from number objects. A permutation is any set or subset of objects or
* events where internal order is significant. Permutations are different from
* combinations, for which the internal order is not significant. Use this function
* for lottery-style probability calculations.
*
* @param int $numObjs Number of different objects
* @param int $numInSet Number of objects in each permutation

View File

@ -42,9 +42,11 @@ Fixed in SVN:
- Feature: (MBaker) Options for cell caching using Igbinary and SQLite/SQlite3.
- Feature: (MBaker) Additional row iterator options: allow a start row to be defined in the constructor; seek(), and prev() methods added.
- Feature: (Progi1984) Work item 9759 - Implement document properties in Excel5 writer
- Feature: (MBaker) Initial definition of chart objects.
- Feature: (MBaker) Work item 16 - Implement chart functionality (EXPERIMENTAL)
Initial definition of chart objects.
Reading Chart definitions through the Excel2007 Reader
Facility to render charts to images using the 3rd-party jpgraph library
Writing Charts using the Excel2007 Writer
- General: (MBaker) Fix to build to ensure that Examples are included with the documentation
- General: (MBaker) Reduce cell caching overhead using dirty flag to ensure that cells are only rewritten to the cache if they have actually been changed
- General: (MBaker) Improved memory usage in CSV Writer
@ -74,7 +76,8 @@ Fixed in SVN:
- Bugfix: (MBaker) Work item 17262 - Named Range definition in .xls when sheet reeference is quote wrapped
- Bugfix: (MBaker) Work item 17403 - duplicateStyle() method doesn't duplicate conditional formats
Added an equivalent duplicateConditionalStyle() method for duplicating conditional styles
- Bugfix: (MBaker) Work item 17186 - setSelectedCellByColumnAndRow is not working
- Bugfix: (bnr) Work item 17501 - =sumproduct(A,B) <> =sumproduct(B,A) in xlsx
- Bugfix: (Progi1984) Work item 8916 - Support for Rich-Text in PHPExcel_Writer_Excel5
- General: (MBaker) Work item 15405 - Two easy to fix Issues concerning PHPExcel_Token_Stack (l10n/UC)
- General: (MBaker) Work item 15461 - Locale file paths not fit for windows
- General: (MBaker) Work item 16643 - Add file directory as a cache option for cache_to_discISAM