@@ 1924-1938 (lines=15) @@ | ||
1921 | * @param life Number of periods over which the asset is depreciated |
|
1922 | * @return float |
|
1923 | */ |
|
1924 | public static function SLN($cost, $salvage, $life) |
|
1925 | { |
|
1926 | $cost = Functions::flattenSingleValue($cost); |
|
1927 | $salvage = Functions::flattenSingleValue($salvage); |
|
1928 | $life = Functions::flattenSingleValue($life); |
|
1929 | ||
1930 | // Calculate |
|
1931 | if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life))) { |
|
1932 | if ($life < 0) { |
|
1933 | return Functions::NAN(); |
|
1934 | } |
|
1935 | ||
1936 | return ($cost - $salvage) / $life; |
|
1937 | } |
|
1938 | ||
1939 | return Functions::VALUE(); |
|
1940 | } |
|
1941 |
@@ 2737-2750 (lines=14) @@ | ||
2734 | * @param int $numInSet Number of objects in each permutation |
|
2735 | * @return int Number of permutations |
|
2736 | */ |
|
2737 | public static function PERMUT($numObjs, $numInSet) |
|
2738 | { |
|
2739 | $numObjs = Functions::flattenSingleValue($numObjs); |
|
2740 | $numInSet = Functions::flattenSingleValue($numInSet); |
|
2741 | ||
2742 | if ((is_numeric($numObjs)) && (is_numeric($numInSet))) { |
|
2743 | $numInSet = floor($numInSet); |
|
2744 | if ($numObjs < $numInSet) { |
|
2745 | return Functions::NAN(); |
|
2746 | } |
|
2747 | ||
2748 | return round(MathTrig::FACT($numObjs) / MathTrig::FACT($numObjs - $numInSet)); |
|
2749 | } |
|
2750 | ||
2751 | return Functions::VALUE(); |
|
2752 | } |
|
2753 | ||
@@ 3005-3018 (lines=14) @@ | ||
3002 | * @param float $stdDev Standard Deviation |
|
3003 | * @return float Standardized value |
|
3004 | */ |
|
3005 | public static function STANDARDIZE($value, $mean, $stdDev) |
|
3006 | { |
|
3007 | $value = Functions::flattenSingleValue($value); |
|
3008 | $mean = Functions::flattenSingleValue($mean); |
|
3009 | $stdDev = Functions::flattenSingleValue($stdDev); |
|
3010 | ||
3011 | if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { |
|
3012 | if ($stdDev <= 0) { |
|
3013 | return Functions::NAN(); |
|
3014 | } |
|
3015 | ||
3016 | return ($value - $mean) / $stdDev; |
|
3017 | } |
|
3018 | ||
3019 | return Functions::VALUE(); |
|
3020 | } |
|
3021 |