-
Notifications
You must be signed in to change notification settings - Fork 0
normalize
Subhajit Sahu edited this page Aug 8, 2022
·
2 revisions
Normalize a number from its current range into a value between 0 and 1.
function normalize(x, r, R)
// x: a number
// r: lower bound of current range
// R: upper bound of current range
const xmath = require('extra-math');
xmath.normalize(20, 0, 50);
// → 0.4
xmath.normalize(-10, 0, 100);
// → -0.1