private static function PHPExcel_Calculation_MathTrig::_factors in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php \PHPExcel_Calculation_MathTrig::_factors()
2 calls to PHPExcel_Calculation_MathTrig::_factors()
- PHPExcel_Calculation_MathTrig::GCD in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php
- * GCD
*
* Returns the greatest common divisor of a series of numbers.
* The greatest common divisor is the largest integer that divides both
* number1 and number2 without a remainder.
*
* Excel Function:
* GCD(number1[,number2[,…
- PHPExcel_Calculation_MathTrig::LCM in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php
- * LCM
*
* Returns the lowest common multiplier of a series of numbers
* The least common multiple is the smallest positive integer that is a multiple
* of all integer arguments number1, number2, and so on. Use LCM to add fractions
* with…
File
- vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php, line 51
Class
- PHPExcel_Calculation_MathTrig
- PHPExcel_Calculation_MathTrig
Code
private static function _factors($value) {
$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 (!empty($factorArray)) {
rsort($factorArray);
return $factorArray;
}
else {
return array(
(int) $value,
);
}
}