MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / percentile

Function percentile

tooling/scripts/perf-runtime-repeat.mjs:202–207  ·  view source on GitHub ↗
(values, p)

Source from the content-addressed store, hash-verified

200}
201
202function percentile(values, p) {
203 if (values.length === 0) return 0
204 const sorted = [...values].sort((a, b) => a - b)
205 const index = Math.min(sorted.length - 1, Math.max(0, Math.ceil((p / 100) * sorted.length) - 1))
206 return sorted[index]
207}
208
209function round(value) {
210 return Math.round(value * 100) / 100

Callers 1

printSummaryFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected