Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
377 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var $ = require('../internals/export');
|
---|
| 2 | var expm1 = require('../internals/math-expm1');
|
---|
| 3 |
|
---|
| 4 | var exp = Math.exp;
|
---|
| 5 |
|
---|
| 6 | // `Math.tanh` method
|
---|
| 7 | // https://tc39.es/ecma262/#sec-math.tanh
|
---|
| 8 | $({ target: 'Math', stat: true }, {
|
---|
| 9 | tanh: function tanh(x) {
|
---|
| 10 | var a = expm1(x = +x);
|
---|
| 11 | var b = expm1(-x);
|
---|
| 12 | return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
|
---|
| 13 | }
|
---|
| 14 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.