Open jerome-benoit opened 4 months ago
The implementation borrowed from mitata is incorrect and off by at least one for all quantiles.
mitata
Correct implementation:
const quantile = (arr, q) => { const base = (arr.length - 1) * q; const baseIndex = Math.floor(base); if (arr[baseIndex + 1] != null) { return ( arr[baseIndex] + (base - baseIndex) * (arr[baseIndex + 1] - arr[baseIndex]) ); } return arr[baseIndex]; };
Interesting, could you send a PR with a test?
The implementation borrowed from
mitata
is incorrect and off by at least one for all quantiles.Correct implementation:
Upvote & Fund