@@ 2024-2050 (lines=27) @@ | ||
2021 | * |
|
2022 | * @return float |
|
2023 | */ |
|
2024 | public static function LARGE() |
|
2025 | { |
|
2026 | $aArgs = Functions::flattenArray(func_get_args()); |
|
2027 | ||
2028 | // Calculate |
|
2029 | $entry = floor(array_pop($aArgs)); |
|
2030 | ||
2031 | if ((is_numeric($entry)) && (!is_string($entry))) { |
|
2032 | $mArgs = []; |
|
2033 | foreach ($aArgs as $arg) { |
|
2034 | // Is it a numeric value? |
|
2035 | if ((is_numeric($arg)) && (!is_string($arg))) { |
|
2036 | $mArgs[] = $arg; |
|
2037 | } |
|
2038 | } |
|
2039 | $count = self::COUNT($mArgs); |
|
2040 | $entry = floor(--$entry); |
|
2041 | if (($entry < 0) || ($entry >= $count) || ($count == 0)) { |
|
2042 | return Functions::NAN(); |
|
2043 | } |
|
2044 | rsort($mArgs); |
|
2045 | ||
2046 | return $mArgs[$entry]; |
|
2047 | } |
|
2048 | ||
2049 | return Functions::VALUE(); |
|
2050 | } |
|
2051 | ||
2052 | /** |
|
2053 | * LINEST. |
|
@@ 3103-3129 (lines=27) @@ | ||
3100 | * |
|
3101 | * @return float |
|
3102 | */ |
|
3103 | public static function SMALL() |
|
3104 | { |
|
3105 | $aArgs = Functions::flattenArray(func_get_args()); |
|
3106 | ||
3107 | // Calculate |
|
3108 | $entry = array_pop($aArgs); |
|
3109 | ||
3110 | if ((is_numeric($entry)) && (!is_string($entry))) { |
|
3111 | $mArgs = []; |
|
3112 | foreach ($aArgs as $arg) { |
|
3113 | // Is it a numeric value? |
|
3114 | if ((is_numeric($arg)) && (!is_string($arg))) { |
|
3115 | $mArgs[] = $arg; |
|
3116 | } |
|
3117 | } |
|
3118 | $count = self::COUNT($mArgs); |
|
3119 | $entry = floor(--$entry); |
|
3120 | if (($entry < 0) || ($entry >= $count) || ($count == 0)) { |
|
3121 | return Functions::NAN(); |
|
3122 | } |
|
3123 | sort($mArgs); |
|
3124 | ||
3125 | return $mArgs[$entry]; |
|
3126 | } |
|
3127 | ||
3128 | return Functions::VALUE(); |
|
3129 | } |
|
3130 | ||
3131 | /** |
|
3132 | * STANDARDIZE. |