median - nodef/extra-bigint GitHub Wiki

Find the value separating the higher and lower halves of bigints.

Similar: mean, median, modes, variance, range.

function median(...xs)
// xs: a list of bigints
const xbigint = require('extra-bigint');


xbigint.median(1n, 7n);
// → 4n

xbigint.median(1n, 7n, 8n);
// → 7n

xbigint.median(1n, 7n, 8n, 10n);
// → 7n

References