Plato on Github
Report Home
node_modules/es5-ext/math/tanh/shim.js
Maintainability
58.60
Lines of code
15
Difficulty
14.00
Estimated Errors
0.11
Function weight
By Complexity
By SLOC
'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); b = exp(-x); return (a - b) / (a + b); };