ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Calculation_MathTrig Class Reference
+ Collaboration diagram for PHPExcel_Calculation_MathTrig:

Static Public Member Functions

static ATAN2 ($xCoordinate, $yCoordinate)
static CEILING ($number, $significance=null)
 CEILING.
static COMBIN ($numObjs, $numInSet)
 COMBIN.
static EVEN ($number)
 EVEN.
static FACT ($factVal)
 FACT.
static FACTDOUBLE ($factVal)
 FACTDOUBLE.
static FLOOR ($number, $significance=null)
 FLOOR.
static GCD ()
 GCD.
static INT ($number)
 INT.
static LCM ()
 LCM.
static LOG_BASE ($number, $base=10)
static MDETERM ($matrixValues)
 MDETERM.
static MINVERSE ($matrixValues)
 MINVERSE.
static MMULT ($matrixData1, $matrixData2)
 MMULT.
static MOD ($a=1, $b=1)
 MOD.
static MROUND ($number, $multiple)
 MROUND.
static MULTINOMIAL ()
 MULTINOMIAL.
static ODD ($number)
 ODD.
static POWER ($x=0, $y=2)
 POWER.
static PRODUCT ()
static QUOTIENT ()
static RAND ($min=0, $max=0)
 RAND.
static ROMAN ($aValue, $style=0)
static ROUNDUP ($number, $digits)
 ROUNDUP.
static ROUNDDOWN ($number, $digits)
 ROUNDDOWN.
static SERIESSUM ()
 SERIESSUM.
static SIGN ($number)
 SIGN.
static SQRTPI ($number)
 SQRTPI.
static SUBTOTAL ()
 SUBTOTAL.
static SUM ()
static SUMIF ($aArgs, $condition, $sumArgs=array())
static SUMPRODUCT ()
 SUMPRODUCT.
static SUMSQ ()
static SUMX2MY2 ($matrixData1, $matrixData2)
 SUMX2MY2.
static SUMX2PY2 ($matrixData1, $matrixData2)
 SUMX2PY2.
static SUMXMY2 ($matrixData1, $matrixData2)
 SUMXMY2.
static TRUNC ($value=0, $number_digits=0)
 TRUNC.

Static Private Member Functions

static _factors ($value)
static _romanCut ($num, $n)

Detailed Description

Definition at line 46 of file MathTrig.php.

Member Function Documentation

static PHPExcel_Calculation_MathTrig::_factors (   $value)
staticprivate

Definition at line 51 of file MathTrig.php.

Referenced by GCD(), and LCM().

{
$startVal = floor(sqrt($value));
$factorArray = array();
for ($i = $startVal; $i > 1; --$i) {
if (($value % $i) == 0) {
$factorArray = array_merge($factorArray,self::_factors($value / $i));
$factorArray = array_merge($factorArray,self::_factors($i));
if ($i <= sqrt($value)) {
break;
}
}
}
if (count($factorArray) > 0) {
rsort($factorArray);
return $factorArray;
} else {
return array((integer) $value);
}
} // function _factors()

+ Here is the caller graph for this function:

static PHPExcel_Calculation_MathTrig::_romanCut (   $num,
  $n 
)
staticprivate

Definition at line 73 of file MathTrig.php.

Referenced by ROMAN().

{
return ($num - ($num % $n ) ) / $n;
} // function _romanCut()

+ Here is the caller graph for this function:

static PHPExcel_Calculation_MathTrig::ATAN2 (   $xCoordinate,
  $yCoordinate 
)
static

Definition at line 100 of file MathTrig.php.

References PHPExcel_Calculation_Functions\DIV0(), and PHPExcel_Calculation_Functions\flattenSingleValue().

{
$xCoordinate = (float) PHPExcel_Calculation_Functions::flattenSingleValue($xCoordinate);
$yCoordinate = (float) PHPExcel_Calculation_Functions::flattenSingleValue($yCoordinate);
if (($xCoordinate == 0) && ($yCoordinate == 0)) {
}
return atan2($yCoordinate, $xCoordinate);
} // function REVERSE_ATAN2()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::CEILING (   $number,
  $significance = null 
)
static

CEILING.

Returns number rounded up, away from zero, to the nearest multiple of significance.

Parameters
float$numberNumber to round
float$significanceSignificance
Returns
float Rounded Number

Definition at line 121 of file MathTrig.php.

References PHPExcel_Calculation_Functions\COMPATIBILITY_GNUMERIC, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by EVEN(), and ODD().

{
$significance = $number/abs($number);
}
if ((is_numeric($number)) && (is_numeric($significance))) {
if (self::SIGN($number) == self::SIGN($significance)) {
if ($significance == 0.0) {
return 0;
}
return ceil($number / $significance) * $significance;
} else {
}
}
} // function CEILING()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_MathTrig::COMBIN (   $numObjs,
  $numInSet 
)
static

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.

Parameters
int$numObjsNumber of different objects
int$numInSetNumber of objects in each combination
Returns
int Number of combinations

Definition at line 153 of file MathTrig.php.

References FACT(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by PHPExcel_Calculation_Statistical\BINOMDIST(), PHPExcel_Calculation_Statistical\HYPGEOMDIST(), and PHPExcel_Calculation_Statistical\NEGBINOMDIST().

{
if ((is_numeric($numObjs)) && (is_numeric($numInSet))) {
if ($numObjs < $numInSet) {
} elseif ($numInSet < 0) {
}
return round(self::FACT($numObjs) / self::FACT($numObjs - $numInSet)) / self::FACT($numInSet);
}
} // function COMBIN()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_MathTrig::EVEN (   $number)
static

EVEN.

Returns number rounded up to the nearest even integer.

Parameters
float$numberNumber to round
Returns
int Rounded Number

Definition at line 177 of file MathTrig.php.

References CEILING(), PHPExcel_Calculation_Functions\flattenSingleValue(), SIGN(), and PHPExcel_Calculation_Functions\VALUE().

{
if (is_null($number)) {
return 0;
} elseif (is_numeric($number)) {
$significance = 2 * self::SIGN($number);
return (int) self::CEILING($number,$significance);
}
} // function EVEN()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::FACT (   $factVal)
static

FACT.

Returns the factorial of a number.

Parameters
float$factValFactorial Value
Returns
int Factorial

Definition at line 198 of file MathTrig.php.

References PHPExcel_Calculation_Functions\COMPATIBILITY_GNUMERIC, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by PHPExcel_Calculation_Engineering\BESSELI(), PHPExcel_Calculation_Engineering\BESSELJ(), COMBIN(), MULTINOMIAL(), PHPExcel_Calculation_Statistical\PERMUT(), and PHPExcel_Calculation_Statistical\POISSON().

{
if (is_numeric($factVal)) {
if ($factVal < 0) {
}
$factLoop = floor($factVal);
if ($factVal > $factLoop) {
}
}
$factorial = 1;
while ($factLoop > 1) {
$factorial *= $factLoop--;
}
return $factorial ;
}
} // function FACT()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_MathTrig::FACTDOUBLE (   $factVal)
static

FACTDOUBLE.

Returns the double factorial of a number.

Parameters
float$factValFactorial Value
Returns
int Double Factorial

Definition at line 230 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
if (is_numeric($factLoop)) {
if ($factVal < 0) {
}
$factorial = 1;
while ($factLoop > 1) {
$factorial *= $factLoop--;
--$factLoop;
}
return $factorial ;
}
} // function FACTDOUBLE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::FLOOR (   $number,
  $significance = null 
)
static

FLOOR.

Rounds number down, toward zero, to the nearest multiple of significance.

Parameters
float$numberNumber to round
float$significanceSignificance
Returns
float Rounded Number

Definition at line 257 of file MathTrig.php.

References PHPExcel_Calculation_Functions\COMPATIBILITY_GNUMERIC, PHPExcel_Calculation_Functions\DIV0(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
$significance = $number/abs($number);
}
if ((is_numeric($number)) && (is_numeric($significance))) {
if ((float) $significance == 0.0) {
}
if (self::SIGN($number) == self::SIGN($significance)) {
return floor($number / $significance) * $significance;
} else {
}
}
} // function FLOOR()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::GCD ( )
static

GCD.

Returns the greatest common divisor of a series of numbers

Parameters
$arrayValues to calculate the Greatest Common Divisor
Returns
int Greatest Common Divisor

Definition at line 287 of file MathTrig.php.

References _factors(), and PHPExcel_Calculation_Functions\flattenArray().

Referenced by PHPExcel_Style_NumberFormat\toFormattedString().

{
$returnValue = 1;
$allPoweredFactors = array();
// Loop through arguments
foreach(PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $value) {
if ($value == 0) {
break;
}
$myFactors = self::_factors($value);
$myCountedFactors = array_count_values($myFactors);
$allValuesFactors[] = $myCountedFactors;
}
$allValuesCount = count($allValuesFactors);
$mergedArray = $allValuesFactors[0];
for ($i=1;$i < $allValuesCount; ++$i) {
$mergedArray = array_intersect_key($mergedArray,$allValuesFactors[$i]);
}
$mergedArrayValues = count($mergedArray);
if ($mergedArrayValues == 0) {
return $returnValue;
} elseif ($mergedArrayValues > 1) {
foreach($mergedArray as $mergedKey => $mergedValue) {
foreach($allValuesFactors as $highestPowerTest) {
foreach($highestPowerTest as $testKey => $testValue) {
if (($testKey == $mergedKey) && ($testValue < $mergedValue)) {
$mergedArray[$mergedKey] = $testValue;
$mergedValue = $testValue;
}
}
}
}
$returnValue = 1;
foreach($mergedArray as $key => $value) {
$returnValue *= pow($key,$value);
}
return $returnValue;
} else {
$keys = array_keys($mergedArray);
$key = $keys[0];
$value = $mergedArray[$key];
foreach($allValuesFactors as $testValue) {
foreach($testValue as $mergedKey => $mergedValue) {
if (($mergedKey == $key) && ($mergedValue < $value)) {
$value = $mergedValue;
}
}
}
return pow($key,$value);
}
} // function GCD()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_MathTrig::INT (   $number)
static

INT.

Casts a floating point value to an integer

Parameters
float$numberNumber to cast to an integer
Returns
integer Integer value

Definition at line 348 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

{
if (is_numeric($number)) {
return (int) floor($number);
}
} // function INT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::LCM ( )
static

LCM.

Returns the lowest common multiplier of a series of numbers

Parameters
$arrayValues to calculate the Lowest Common Multiplier
Returns
int Lowest Common Multiplier

Definition at line 366 of file MathTrig.php.

References _factors(), PHPExcel_Calculation_Functions\flattenArray(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
$returnValue = 1;
$allPoweredFactors = array();
// Loop through arguments
foreach(PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $value) {
if (!is_numeric($value)) {
}
if ($value == 0) {
return 0;
} elseif ($value < 0) {
}
$myFactors = self::_factors(floor($value));
$myCountedFactors = array_count_values($myFactors);
$myPoweredFactors = array();
foreach($myCountedFactors as $myCountedFactor => $myCountedPower) {
$myPoweredFactors[$myCountedFactor] = pow($myCountedFactor,$myCountedPower);
}
foreach($myPoweredFactors as $myPoweredValue => $myPoweredFactor) {
if (array_key_exists($myPoweredValue,$allPoweredFactors)) {
if ($allPoweredFactors[$myPoweredValue] < $myPoweredFactor) {
$allPoweredFactors[$myPoweredValue] = $myPoweredFactor;
}
} else {
$allPoweredFactors[$myPoweredValue] = $myPoweredFactor;
}
}
}
foreach($allPoweredFactors as $allPoweredFactor) {
$returnValue *= (integer) $allPoweredFactor;
}
return $returnValue;
} // function LCM()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::LOG_BASE (   $number,
  $base = 10 
)
static

Definition at line 416 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenSingleValue().

{
$base = (is_null($base)) ? 10 : (float) PHPExcel_Calculation_Functions::flattenSingleValue($base);
return log($number, $base);
} // function LOG_BASE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::MDETERM (   $matrixValues)
static

MDETERM.

Parameters
array$matrixValuesA matrix of values
Returns
float

Definition at line 430 of file MathTrig.php.

References $row, and PHPExcel_Calculation_Functions\VALUE().

{
$matrixData = array();
if (!is_array($matrixValues)) { $matrixValues = array(array($matrixValues)); }
$row = $maxColumn = 0;
foreach($matrixValues as $matrixRow) {
$column = 0;
foreach($matrixRow as $matrixCell) {
if ((is_string($matrixCell)) || ($matrixCell === null)) {
}
$matrixData[$column][$row] = $matrixCell;
++$column;
}
if ($column > $maxColumn) { $maxColumn = $column; }
++$row;
}
if ($row != $maxColumn) { return PHPExcel_Calculation_Functions::VALUE(); }
try {
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
return $matrix->det();
} catch (Exception $ex) {
}
} // function MDETERM()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::MINVERSE (   $matrixValues)
static

MINVERSE.

Parameters
array$matrixValuesA matrix of values
Returns
array

Definition at line 464 of file MathTrig.php.

References $row, and PHPExcel_Calculation_Functions\VALUE().

{
$matrixData = array();
if (!is_array($matrixValues)) { $matrixValues = array(array($matrixValues)); }
$row = $maxColumn = 0;
foreach($matrixValues as $matrixRow) {
$column = 0;
foreach($matrixRow as $matrixCell) {
if ((is_string($matrixCell)) || ($matrixCell === null)) {
}
$matrixData[$column][$row] = $matrixCell;
++$column;
}
if ($column > $maxColumn) { $maxColumn = $column; }
++$row;
}
if ($row != $maxColumn) { return PHPExcel_Calculation_Functions::VALUE(); }
try {
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
return $matrix->inverse()->getArray();
} catch (Exception $ex) {
}
} // function MINVERSE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::MMULT (   $matrixData1,
  $matrixData2 
)
static

MMULT.

Parameters
array$matrixData1A matrix of values
array$matrixData2A matrix of values
Returns
array

Definition at line 499 of file MathTrig.php.

References PHPExcel_Calculation_Functions\VALUE().

{
$matrixAData = $matrixBData = array();
if (!is_array($matrixData1)) { $matrixData1 = array(array($matrixData1)); }
if (!is_array($matrixData2)) { $matrixData2 = array(array($matrixData2)); }
$rowA = 0;
foreach($matrixData1 as $matrixRow) {
$columnA = 0;
foreach($matrixRow as $matrixCell) {
if ((is_string($matrixCell)) || ($matrixCell === null)) {
}
$matrixAData[$rowA][$columnA] = $matrixCell;
++$columnA;
}
++$rowA;
}
try {
$matrixA = new PHPExcel_Shared_JAMA_Matrix($matrixAData);
$rowB = 0;
foreach($matrixData2 as $matrixRow) {
$columnB = 0;
foreach($matrixRow as $matrixCell) {
if ((is_string($matrixCell)) || ($matrixCell === null)) {
}
$matrixBData[$rowB][$columnB] = $matrixCell;
++$columnB;
}
++$rowB;
}
$matrixB = new PHPExcel_Shared_JAMA_Matrix($matrixBData);
if (($rowA != $columnB) || ($rowB != $columnA)) {
}
return $matrixA->times($matrixB)->getArray();
} catch (Exception $ex) {
}
} // function MMULT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::MOD (   $a = 1,
  $b = 1 
)
static

MOD.

Parameters
int$aDividend
int$bDivisor
Returns
int Remainder

Definition at line 550 of file MathTrig.php.

References PHPExcel_Calculation_Functions\DIV0(), and PHPExcel_Calculation_Functions\flattenSingleValue().

{
if ($b == 0.0) {
} elseif (($a < 0.0) && ($b > 0.0)) {
return $b - fmod(abs($a),$b);
} elseif (($a > 0.0) && ($b < 0.0)) {
return $b + fmod($a,abs($b));
}
return fmod($a,$b);
} // function MOD()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::MROUND (   $number,
  $multiple 
)
static

MROUND.

Rounds a number to the nearest multiple of a specified value

Parameters
float$numberNumber to round
int$multipleMultiple to which you want to round $number
Returns
float Rounded Number

Definition at line 575 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by PHPExcel_Calculation_TextData\DOLLAR().

{
if ((is_numeric($number)) && (is_numeric($multiple))) {
if ($multiple == 0) {
return 0;
}
if ((self::SIGN($number)) == (self::SIGN($multiple))) {
$multiplier = 1 / $multiple;
return round($number * $multiplier) / $multiplier;
}
}
} // function MROUND()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_MathTrig::MULTINOMIAL ( )
static

MULTINOMIAL.

Returns the ratio of the factorial of a sum of values to the product of factorials.

Parameters
arrayof mixed Data Series
Returns
float

Definition at line 601 of file MathTrig.php.

References $arg, FACT(), PHPExcel_Calculation_Functions\flattenArray(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
$summer = 0;
$divisor = 1;
// Loop through arguments
foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
// Is it a numeric value?
if (is_numeric($arg)) {
if ($arg < 1) {
}
$summer += floor($arg);
$divisor *= self::FACT($arg);
} else {
}
}
// Return
if ($summer > 0) {
$summer = self::FACT($summer);
return $summer / $divisor;
}
return 0;
} // function MULTINOMIAL()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::ODD (   $number)
static

ODD.

Returns number rounded up to the nearest odd integer.

Parameters
float$numberNumber to round
Returns
int Rounded Number

Definition at line 635 of file MathTrig.php.

References CEILING(), PHPExcel_Calculation_Functions\flattenSingleValue(), SIGN(), and PHPExcel_Calculation_Functions\VALUE().

{
if (is_null($number)) {
return 1;
} elseif (is_numeric($number)) {
$significance = self::SIGN($number);
if ($significance == 0) {
return 1;
}
$result = self::CEILING($number,$significance);
if ($result == self::EVEN($result)) {
$result += $significance;
}
return (int) $result;
}
} // function ODD()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::POWER (   $x = 0,
  $y = 2 
)
static

POWER.

Computes x raised to the power y.

Parameters
float$x
float$y
Returns
float

Definition at line 666 of file MathTrig.php.

References $x, $y, PHPExcel_Calculation_Functions\DIV0(), and PHPExcel_Calculation_Functions\flattenSingleValue().

{
// Validate parameters
if ($x == 0 && $y <= 0) {
}
// Return
return pow($x, $y);
} // function POWER()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::PRODUCT ( )
static

Definition at line 693 of file MathTrig.php.

References $arg, and PHPExcel_Calculation_Functions\flattenArray().

Referenced by PHPExcel_Calculation_Database\DPRODUCT(), PHPExcel_Calculation_Statistical\GEOMEAN(), and SUBTOTAL().

{
// Return value
$returnValue = null;
// Loop through arguments
foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
if (is_null($returnValue)) {
$returnValue = $arg;
} else {
$returnValue *= $arg;
}
}
}
// Return
if (is_null($returnValue)) {
return 0;
}
return $returnValue;
} // function PRODUCT()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_MathTrig::QUOTIENT ( )
static

Definition at line 731 of file MathTrig.php.

References $arg, and PHPExcel_Calculation_Functions\flattenArray().

{
// Return value
$returnValue = null;
// Loop through arguments
foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
if (is_null($returnValue)) {
$returnValue = ($arg == 0) ? 0 : $arg;
} else {
if (($returnValue == 0) || ($arg == 0)) {
$returnValue = 0;
} else {
$returnValue /= $arg;
}
}
}
}
// Return
return intval($returnValue);
} // function QUOTIENT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::RAND (   $min = 0,
  $max = 0 
)
static

RAND.

Parameters
int$minMinimal value
int$maxMaximal value
Returns
int Random number

Definition at line 763 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenSingleValue().

{
if ($min == 0 && $max == 0) {
return (rand(0,10000000)) / 10000000;
} else {
return rand($min, $max);
}
} // function RAND()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::ROMAN (   $aValue,
  $style = 0 
)
static

Definition at line 775 of file MathTrig.php.

References $t, _romanCut(), PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

{
$style = (is_null($style)) ? 0 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($style);
if ((!is_numeric($aValue)) || ($aValue < 0) || ($aValue >= 4000)) {
}
if ($aValue == 0) {
return '';
}
$mill = Array('', 'M', 'MM', 'MMM', 'MMMM', 'MMMMM');
$cent = Array('', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM');
$tens = Array('', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC');
$ones = Array('', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX');
$roman = '';
while ($aValue > 5999) {
$roman .= 'M';
$aValue -= 1000;
}
$m = self::_romanCut($aValue, 1000); $aValue %= 1000;
$c = self::_romanCut($aValue, 100); $aValue %= 100;
$t = self::_romanCut($aValue, 10); $aValue %= 10;
return $roman.$mill[$m].$cent[$c].$tens[$t].$ones[$aValue];
} // function ROMAN()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::ROUNDDOWN (   $number,
  $digits 
)
static

ROUNDDOWN.

Rounds a number down to a specified number of decimal places

Parameters
float$numberNumber to round
int$digitsNumber of digits to which you want to round $number
Returns
float Rounded Number

Definition at line 837 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

{
if ((is_numeric($number)) && (is_numeric($digits))) {
$significance = pow(10,$digits);
if ($number < 0.0) {
return ceil($number * $significance) / $significance;
} else {
return floor($number * $significance) / $significance;
}
}
} // function ROUNDDOWN()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::ROUNDUP (   $number,
  $digits 
)
static

ROUNDUP.

Rounds a number up to a specified number of decimal places

Parameters
float$numberNumber to round
int$digitsNumber of digits to which you want to round $number
Returns
float Rounded Number

Definition at line 812 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

{
if ((is_numeric($number)) && (is_numeric($digits))) {
$significance = pow(10,$digits);
if ($number < 0.0) {
return floor($number * $significance) / $significance;
} else {
return ceil($number * $significance) / $significance;
}
}
} // function ROUNDUP()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::SERIESSUM ( )
static

SERIESSUM.

Returns the sum of a power series

Parameters
float$xInput value to the power series
float$nInitial power to which you want to raise $x
float$mStep by which to increase $n for each term in the series
arrayof mixed Data Series
Returns
float

Definition at line 864 of file MathTrig.php.

References $arg, $x, PHPExcel_Calculation_Functions\flattenArray(), and PHPExcel_Calculation_Functions\VALUE().

{
// Return value
$returnValue = 0;
// Loop through arguments
$x = array_shift($aArgs);
$n = array_shift($aArgs);
$m = array_shift($aArgs);
if ((is_numeric($x)) && (is_numeric($n)) && (is_numeric($m))) {
// Calculate
$i = 0;
foreach($aArgs as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
$returnValue += $arg * pow($x,$n + ($m * $i++));
} else {
}
}
// Return
return $returnValue;
}
} // function SERIESSUM()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::SIGN (   $number)
static

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.

Parameters
float$numberNumber to round
Returns
int sign value

Definition at line 902 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by EVEN(), and ODD().

{
if (is_numeric($number)) {
if ($number == 0.0) {
return 0;
}
return $number / abs($number);
}
} // function SIGN()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_MathTrig::SQRTPI (   $number)
static

SQRTPI.

Returns the square root of (number * pi).

Parameters
float$numberNumber
Returns
float Square Root of Number * Pi

Definition at line 923 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
if (is_numeric($number)) {
if ($number < 0) {
}
return sqrt($number * M_PI) ;
}
} // function SQRTPI()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::SUBTOTAL ( )
static

SUBTOTAL.

Returns a subtotal in a list or database.

Parameters
intthe number 1 to 11 that specifies which function to use in calculating subtotals within a list.
arrayof mixed Data Series
Returns
float

Definition at line 946 of file MathTrig.php.

References PHPExcel_Calculation_Statistical\AVERAGE(), PHPExcel_Calculation_Statistical\COUNT(), PHPExcel_Calculation_Statistical\COUNTA(), PHPExcel_Calculation_Functions\flattenArray(), PHPExcel_Calculation_Statistical\MAX(), PHPExcel_Calculation_Statistical\MIN(), PRODUCT(), PHPExcel_Calculation_Statistical\STDEV(), PHPExcel_Calculation_Statistical\STDEVP(), SUM(), PHPExcel_Calculation_Functions\VALUE(), PHPExcel_Calculation_Statistical\VARFunc(), and PHPExcel_Calculation_Statistical\VARP().

{
// Calculate
$subtotal = array_shift($aArgs);
if ((is_numeric($subtotal)) && (!is_string($subtotal))) {
switch($subtotal) {
case 1 :
break;
case 2 :
break;
case 3 :
break;
case 4 :
break;
case 5 :
break;
case 6 :
return self::PRODUCT($aArgs);
break;
case 7 :
break;
case 8 :
break;
case 9 :
return self::SUM($aArgs);
break;
case 10 :
break;
case 11 :
break;
}
}
} // function SUBTOTAL()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::SUM ( )
static

Definition at line 1006 of file MathTrig.php.

References $arg, and PHPExcel_Calculation_Functions\flattenArray().

Referenced by PHPExcel_Calculation_Database\DSUM(), and SUBTOTAL().

{
// Return value
$returnValue = 0;
// Loop through the arguments
foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
$returnValue += $arg;
}
}
// Return
return $returnValue;
} // function SUM()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_MathTrig::SUMIF (   $aArgs,
  $condition,
  $sumArgs = array() 
)
static

Definition at line 1037 of file MathTrig.php.

References $arg, PHPExcel_Calculation_Functions\_ifCondition(), PHPExcel_Calculation\_wrapResult(), PHPExcel_Calculation_Functions\flattenArray(), and PHPExcel_Calculation\getInstance().

{
// Return value
$returnValue = 0;
if (count($sumArgs) == 0) {
$sumArgs = $aArgs;
}
// Loop through arguments
foreach ($aArgs as $key => $arg) {
if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); }
$testCondition = '='.$arg.$condition;
if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
// Is it a value within our criteria
$returnValue += $sumArgs[$key];
}
}
// Return
return $returnValue;
} // function SUMIF()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::SUMPRODUCT ( )
static

SUMPRODUCT.

Parameters
mixed$valueValue to check
Returns
float

Definition at line 1068 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenArray(), and PHPExcel_Calculation_Functions\VALUE().

{
$arrayList = func_get_args();
$wrkArray = PHPExcel_Calculation_Functions::flattenArray(array_shift($arrayList));
$wrkCellCount = count($wrkArray);
foreach($arrayList as $matrixData) {
$count = count($array2);
if ($wrkCellCount != $count) {
}
foreach ($array2 as $i => $val) {
if (((is_numeric($wrkArray[$i])) && (!is_string($wrkArray[$i]))) &&
((is_numeric($val)) && (!is_string($val)))) {
$wrkArray[$i] *= $val;
}
}
}
return array_sum($wrkArray);
} // function SUMPRODUCT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::SUMSQ ( )
static

Definition at line 1106 of file MathTrig.php.

References $arg, and PHPExcel_Calculation_Functions\flattenArray().

{
// Return value
$returnValue = 0;
// Loop through arguments
foreach (PHPExcel_Calculation_Functions::flattenArray(func_get_args()) as $arg) {
// Is it a numeric value?
if ((is_numeric($arg)) && (!is_string($arg))) {
$returnValue += ($arg * $arg);
}
}
// Return
return $returnValue;
} // function SUMSQ()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::SUMX2MY2 (   $matrixData1,
  $matrixData2 
)
static

SUMX2MY2.

Parameters
mixed$valueValue to check
Returns
float

Definition at line 1129 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenArray().

{
$count1 = count($array1);
$count2 = count($array2);
if ($count1 < $count2) {
$count = $count1;
} else {
$count = $count2;
}
$result = 0;
for ($i = 0; $i < $count; ++$i) {
if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) &&
((is_numeric($array2[$i])) && (!is_string($array2[$i])))) {
$result += ($array1[$i] * $array1[$i]) - ($array2[$i] * $array2[$i]);
}
}
return $result;
} // function SUMX2MY2()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::SUMX2PY2 (   $matrixData1,
  $matrixData2 
)
static

SUMX2PY2.

Parameters
mixed$valueValue to check
Returns
float

Definition at line 1158 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenArray().

{
$count1 = count($array1);
$count2 = count($array2);
if ($count1 < $count2) {
$count = $count1;
} else {
$count = $count2;
}
$result = 0;
for ($i = 0; $i < $count; ++$i) {
if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) &&
((is_numeric($array2[$i])) && (!is_string($array2[$i])))) {
$result += ($array1[$i] * $array1[$i]) + ($array2[$i] * $array2[$i]);
}
}
return $result;
} // function SUMX2PY2()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::SUMXMY2 (   $matrixData1,
  $matrixData2 
)
static

SUMXMY2.

Parameters
mixed$valueValue to check
Returns
float

Definition at line 1187 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenArray().

{
$count1 = count($array1);
$count2 = count($array2);
if ($count1 < $count2) {
$count = $count1;
} else {
$count = $count2;
}
$result = 0;
for ($i = 0; $i < $count; ++$i) {
if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) &&
((is_numeric($array2[$i])) && (!is_string($array2[$i])))) {
$result += ($array1[$i] - $array2[$i]) * ($array1[$i] - $array2[$i]);
}
}
return $result;
} // function SUMXMY2()

+ Here is the call graph for this function:

static PHPExcel_Calculation_MathTrig::TRUNC (   $value = 0,
  $number_digits = 0 
)
static

TRUNC.

Truncates value to the number of fractional digits by number_digits.

Parameters
float$value
int$number_digits
Returns
float Truncated value

Definition at line 1219 of file MathTrig.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

{
$number_digits = PHPExcel_Calculation_Functions::flattenSingleValue($number_digits);
// Validate parameters
if ($number_digits < 0) {
}
// Truncate
if ($number_digits > 0) {
$value = $value * pow(10, $number_digits);
}
$value = intval($value);
if ($number_digits > 0) {
$value = $value / pow(10, $number_digits);
}
// Return
return $value;
} // function TRUNC()

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: