php.js
Version:
Use phpjs functions as required.
10 lines (8 loc) • 332 B
JavaScript
module.exports=function(){ return tanh.apply(exports,arguments) };
function tanh(arg) {
// discuss at: http://phpjs.org/functions/tanh/
// original by: Onno Marsman
// example 1: tanh(5.4251848798444815);
// returns 1: 0.9999612058841574
return (Math.exp(arg) - Math.exp(-arg)) / (Math.exp(arg) + Math.exp(-arg));
}