-
Notifications
You must be signed in to change notification settings - Fork 2
remap
Subhajit Sahu edited this page Aug 9, 2022
·
1 revision
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