Blame view
node_modules/es5-ext/math/tanh/shim.js
330 Bytes
f7563de62
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
'use strict'; var exp = Math.exp; module.exports = function (x) { var a, b; if (isNaN(x)) return NaN; x = Number(x); if (x === 0) return x; if (x === Infinity) return 1; if (x === -Infinity) return -1; a = exp(x); if (a === Infinity) return 1; b = exp(-x); if (b === Infinity) return -1; return (a - b) / (a + b); }; |