calc median g_

This commit is contained in:
olli 2024-08-16 23:27:37 +02:00
parent be7e5da172
commit 4342f0a5f8

View File

@ -18,7 +18,8 @@ function g_median {
if (($g_num_elements % 2 == 1))
then
# odd number
g_median=${g_sorted_numbers[$g_middle]}
g_median="${g_sorted_numbers[$g_middle]}"
echo "$g_median - ${g_sorted_numbers[$g_middle]} - $g_middle"
else
# even number
g_calc "(${g_sorted_numbers[$g_middle - 1]} + ${g_sorted_numbers[$g_middle]}) / 2"