main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
404 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | 'use strict';
|
---|
| 2 | var $ = require('../internals/export');
|
---|
| 3 | var expm1 = require('../internals/math-expm1');
|
---|
| 4 |
|
---|
| 5 | var exp = Math.exp;
|
---|
| 6 |
|
---|
| 7 | // `Math.tanh` method
|
---|
| 8 | // https://tc39.es/ecma262/#sec-math.tanh
|
---|
| 9 | $({ target: 'Math', stat: true }, {
|
---|
| 10 | tanh: function tanh(x) {
|
---|
| 11 | var n = +x;
|
---|
| 12 | var a = expm1(n);
|
---|
| 13 | var b = expm1(-n);
|
---|
| 14 | return a === Infinity ? 1 : b === Infinity ? -1 : (a - b) / (exp(n) + exp(-n));
|
---|
| 15 | }
|
---|
| 16 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.