diff --git a/src/quantile.js b/src/quantile.js index a467f7d1..da6e5c1f 100644 --- a/src/quantile.js +++ b/src/quantile.js @@ -2,7 +2,9 @@ import ascending from "./ascending.js"; import number, {numbers} from "./number.js"; export default function quantile(values, p, valueof) { - return quantileSorted(Float64Array.from(numbers(values, valueof)).sort(ascending), p); + values = Float64Array.from(numbers(values, valueof)); + values.sort(ascending); + return quantileSorted(values, p); } export function quantileSorted(values, p, valueof = number) {