Baseline Widely available
La fonction Math.atanh()
renvoie l'arc tangente hyperbolique d'un nombre :
â x â ( - 1 , 1 ) , Math.atanh ( x ) = arctanh ( x ) = le seul y tel que tanh ( y ) = x \forall x \in \left( -1, 1 \right), \mathtt{\operatorname{Math.atanh}(x)} = \operatorname{arctanh}(x) = \text{ the unique } ; y ; \text{such that} ; \tanh(y) = x
Exemple interactifconsole.log(Math.atanh(-1));
// Expected output: -Infinity
console.log(Math.atanh(0));
// Expected output: 0
console.log(Math.atanh(0.5));
// Expected output: 0.549306144334055 (approximately)
console.log(Math.atanh(1));
// Expected output: Infinity
Syntaxe Paramètres Valeur de retour
L'arc tangente hyperbolique du nombre passé en argument.
Descriptionatanh()
est une méthode statique de Math
, il faut utiliser la syntaxe Math.atanh()
, et non pas une méthode d'un objet Math
créé sur mesure (Math
n'est pas un constructeur).
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
Pour les valeurs strictement inférieures à -1 ou strictement supérieures à 1, NaN
sera renvoyé.
Pour | x | < 1 \left|x\right| < 1 , on a la formule suivante : artanh ( x ) = 1 2 ln ( 1 + x 1 - x ) \operatorname {artanh} (x) = \frac{1}{2}\ln \left( \frac{1 + x}{1 - x} \right) et on peut donc émuler la fonction avec :
Math.atanh =
Math.atanh ||
function (x) {
return Math.log((1 + x) / (1 - x)) / 2;
};
Spécifications Compatibilité des navigateurs Voir aussi
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4