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

Function percentile

tooling/scripts/perf-desktop-runtime.mjs:433–438  ·  view source on GitHub ↗
(values, p)

Source from the content-addressed store, hash-verified

431}
432
433function percentile(values, p) {
434 if (values.length === 0) return 0
435 const sorted = [...values].sort((a, b) => a - b)
436 const index = Math.min(sorted.length - 1, Math.max(0, Math.ceil((p / 100) * sorted.length) - 1))
437 return sorted[index]
438}
439
440function round(value) {
441 return Math.round(value * 100) / 100

Callers 1

summarizeLongTasksFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected