@@ 1951-1965 (lines=15) @@ | ||
1948 | * @param life Number of periods over which the asset is depreciated |
|
1949 | * @return float |
|
1950 | */ |
|
1951 | public static function SLN($cost, $salvage, $life) |
|
1952 | { |
|
1953 | $cost = Functions::flattenSingleValue($cost); |
|
1954 | $salvage = Functions::flattenSingleValue($salvage); |
|
1955 | $life = Functions::flattenSingleValue($life); |
|
1956 | ||
1957 | // Calculate |
|
1958 | if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life))) { |
|
1959 | if ($life < 0) { |
|
1960 | return Functions::NAN(); |
|
1961 | } |
|
1962 | return ($cost - $salvage) / $life; |
|
1963 | } |
|
1964 | return Functions::VALUE(); |
|
1965 | } |
|
1966 | ||
1967 | ||
1968 | /** |
@@ 2772-2785 (lines=14) @@ | ||
2769 | * @param int $numInSet Number of objects in each permutation |
|
2770 | * @return int Number of permutations |
|
2771 | */ |
|
2772 | public static function PERMUT($numObjs, $numInSet) |
|
2773 | { |
|
2774 | $numObjs = Functions::flattenSingleValue($numObjs); |
|
2775 | $numInSet = Functions::flattenSingleValue($numInSet); |
|
2776 | ||
2777 | if ((is_numeric($numObjs)) && (is_numeric($numInSet))) { |
|
2778 | $numInSet = floor($numInSet); |
|
2779 | if ($numObjs < $numInSet) { |
|
2780 | return Functions::NAN(); |
|
2781 | } |
|
2782 | return round(MathTrig::FACT($numObjs) / MathTrig::FACT($numObjs - $numInSet)); |
|
2783 | } |
|
2784 | return Functions::VALUE(); |
|
2785 | } |
|
2786 | ||
2787 | ||
2788 | /** |
|
@@ 3040-3053 (lines=14) @@ | ||
3037 | * @param float $stdDev Standard Deviation |
|
3038 | * @return float Standardized value |
|
3039 | */ |
|
3040 | public static function STANDARDIZE($value, $mean, $stdDev) |
|
3041 | { |
|
3042 | $value = Functions::flattenSingleValue($value); |
|
3043 | $mean = Functions::flattenSingleValue($mean); |
|
3044 | $stdDev = Functions::flattenSingleValue($stdDev); |
|
3045 | ||
3046 | if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { |
|
3047 | if ($stdDev <= 0) { |
|
3048 | return Functions::NAN(); |
|
3049 | } |
|
3050 | return ($value - $mean) / $stdDev ; |
|
3051 | } |
|
3052 | return Functions::VALUE(); |
|
3053 | } |
|
3054 | ||
3055 | ||
3056 | /** |