La funció Math.atanh()
retorna l'arctangent hiperbòlica d'un nombre, és a dir
Sintaxi
Math.atanh(x)
Paràmetres
x
- Un nombre.
Descripció
Com que que atanh
() és un mètode estàtic de Math, sempre s'utilitza com a Math.atanh
(), en comptes de com a mètode d'una instància de Math
(Math
no és un constructor).
Exemples
Utilitzar Math.atanh()
Math.atanh(-2); // NaN
Math.atanh(-1); // -Infinity
Math.atanh(0); // 0
Math.atanh(0.5); // 0.5493061443340548
Math.atanh(1); // Infinity
Math.atanh(2); // NaN
Es retorna NaN
per a valors més grans que 1 o més petits que -1.
Polyfill
Per a , tenim que , que podem emular amb la funció següent:
Math.atanh = Math.atanh || function(x) {
return Math.log((1+x)/(1-x)) / 2;
};
Especificacions
Especificació | Estat | Comentaris |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Math.atanh' in that specification. |
Standard | Definició inicial. |
Compatibilitat amb navegadors
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Suport bàsic | 38 | 25 (25) | No support | 25 | 7.1 |
Característica | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Suport bàsic | No support | No support | 25.0 (25) | No support | No support | 8 |