Show More
Commit Description:
add model solution
Commit Description:
add model solution
References:
File last commit:
Show/Diff file:
Action:
node_modules/core-js/modules/_math-scale.js
| 18 lines
| 684 B
| application/javascript
| JavascriptLexer
|
r789 | // https://rwaldron.github.io/proposal-math-extensions/ | |||
module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) { | ||||
if ( | ||||
arguments.length === 0 | ||||
// eslint-disable-next-line no-self-compare | ||||
|| x != x | ||||
// eslint-disable-next-line no-self-compare | ||||
|| inLow != inLow | ||||
// eslint-disable-next-line no-self-compare | ||||
|| inHigh != inHigh | ||||
// eslint-disable-next-line no-self-compare | ||||
|| outLow != outLow | ||||
// eslint-disable-next-line no-self-compare | ||||
|| outHigh != outHigh | ||||
) return NaN; | ||||
if (x === Infinity || x === -Infinity) return x; | ||||
return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow; | ||||
}; | ||||