tmcw/simple-statistics — pull request #14 by jthomm (2012-09-06 22:43:22+00:00)
Title: Give `.sort` a callback to ensure `.median` and `.quantile` sort numerically.

If `.sort` does not get a callback, numbers are sorted by converting them to strings and comparing strings in lexicographic order. This affected `.median` and `.quantile`.

For example, with `.sort()` (no callback), `ss.median([8, 9, 10])` will give 8, because 10 comes before 8 and 9. However, with `.sort(function (a, b) { return a - b; })`, `ss.median([8, 9, 10])` gives the correct answer. (I added this to median.test.js.)