We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af32d77 commit f4e1a56Copy full SHA for f4e1a56
functions/math/tanh.js
@@ -1,8 +1,9 @@
1
function tanh(arg) {
2
// discuss at: http://phpjs.org/functions/tanh/
3
// original by: Onno Marsman
4
+ // imprived by: Robert Eisele (http://www.xarg.org/)
5
// example 1: tanh(5.4251848798444815);
6
// returns 1: 0.9999612058841574
7
- return (Math.exp(arg) - Math.exp(-arg)) / (Math.exp(arg) + Math.exp(-arg));
8
+ return 1 - 2 / (Math.exp(2 * arg) + 1);
9
}
0 commit comments