@@ 1884-1897 (lines=14) @@ | ||
1881 | * @param life Number of periods over which the asset is depreciated |
|
1882 | * @return float |
|
1883 | */ |
|
1884 | public static function SLN($cost, $salvage, $life) { |
|
1885 | $cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost); |
|
1886 | $salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage); |
|
1887 | $life = PHPExcel_Calculation_Functions::flattenSingleValue($life); |
|
1888 | ||
1889 | // Calculate |
|
1890 | if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life))) { |
|
1891 | if ($life < 0) { |
|
1892 | return PHPExcel_Calculation_Functions::NaN(); |
|
1893 | } |
|
1894 | return ($cost - $salvage) / $life; |
|
1895 | } |
|
1896 | return PHPExcel_Calculation_Functions::VALUE(); |
|
1897 | } // function SLN() |
|
1898 | ||
1899 | ||
1900 | /** |
@@ 2700-2712 (lines=13) @@ | ||
2697 | * @param int $numInSet Number of objects in each permutation |
|
2698 | * @return int Number of permutations |
|
2699 | */ |
|
2700 | public static function PERMUT($numObjs,$numInSet) { |
|
2701 | $numObjs = PHPExcel_Calculation_Functions::flattenSingleValue($numObjs); |
|
2702 | $numInSet = PHPExcel_Calculation_Functions::flattenSingleValue($numInSet); |
|
2703 | ||
2704 | if ((is_numeric($numObjs)) && (is_numeric($numInSet))) { |
|
2705 | $numInSet = floor($numInSet); |
|
2706 | if ($numObjs < $numInSet) { |
|
2707 | return PHPExcel_Calculation_Functions::NaN(); |
|
2708 | } |
|
2709 | return round(PHPExcel_Calculation_MathTrig::FACT($numObjs) / PHPExcel_Calculation_MathTrig::FACT($numObjs - $numInSet)); |
|
2710 | } |
|
2711 | return PHPExcel_Calculation_Functions::VALUE(); |
|
2712 | } // function PERMUT() |
|
2713 | ||
2714 | ||
2715 | /** |
|
@@ 2961-2973 (lines=13) @@ | ||
2958 | * @param float $stdDev Standard Deviation |
|
2959 | * @return float Standardized value |
|
2960 | */ |
|
2961 | public static function STANDARDIZE($value,$mean,$stdDev) { |
|
2962 | $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2963 | $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2964 | $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
2965 | ||
2966 | if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { |
|
2967 | if ($stdDev <= 0) { |
|
2968 | return PHPExcel_Calculation_Functions::NaN(); |
|
2969 | } |
|
2970 | return ($value - $mean) / $stdDev ; |
|
2971 | } |
|
2972 | return PHPExcel_Calculation_Functions::VALUE(); |
|
2973 | } // function STANDARDIZE() |
|
2974 | ||
2975 | ||
2976 | /** |