Math.atanh()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Please help us by answering a few questions.
La fonction Math.atanh()
renvoie l'arc tangente hyperbolique d'un nombre :
Exemple interactif
console.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
Math.atanh(x);
Paramètres
x
-
Un nombre.
Valeur de retour
L'arc tangente hyperbolique du nombre passé en argument.
Description
atanh()
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).
Exemple
Utiliser 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é.
Prothèse d'émulation (polyfill)
Pour , on a la formule suivante : et on peut donc émuler la fonction avec :
Math.atanh =
Math.atanh ||
function (x) {
return Math.log((1 + x) / (1 - x)) / 2;
};
Spécifications
Specification |
---|
ECMAScript® 2025 Language Specification # sec-math.atanh |
Compatibilité des navigateurs
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
atanh |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support