remap - nodef/extra-bigint GitHub Wiki
Re-map a bigint from one range to another.
function remap(x, r, R, t, T)
// x: a bigint
// r: lower bound of current range
// R: upper bound of current range
// t: lower bound of target range
// T: upper bound of target range
const xbigint = require('extra-bigint');
xbigint.remap(25n, 0n, 100n, 0n, 1366n);
// → 341n
xbigint.remap(110n, 0n, 100n, -20n, -10n);
// → -9n