1.1.1 • Published 5 years ago

percentile-js v1.1.1

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

Percentile

A simple percentile function for JavaScript (or TypeScript) with linear interpolation, taking O(1) time. This is basically an implementation of the C = 1 algorithm here—the same one used by Excel via the PERCENTILE or PERCENTILE.INC formula functions.

Example

import { percentile } from "percentile-js";

percentile(0.5, [0, 300, 600]);
// 300

percentile(0.75, [0, 300, 600]);
// 450 -- interpolated

percentile(1, [0, 300, 600]);
// 600