Code:
var a[4] = {1, 4, 3, 5};
printf("n%f", Median(a, 4));
printf("n%f", Percentile(a, 4, 50));

# output
4.500000
4.500000



Unless I am much mistaken the median value should be 3.5

Median() always gives the right answer when length is even, and never when length is odd.

Last edited by johnnyp; 09/18/17 22:01.