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.

La fonction Math.atanh() renvoie l'arc tangente hyperbolique d'un nombre :

x(-1,1),Math.atanh(x)=arctanh(x)= le seul y tel quetanh(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 interactif

Syntaxe

js
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()

js
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 |x|<1\left|x\right| < 1, on a la formule suivante : artanh(x)=12ln(1+x1-x)\operatorname {artanh} (x) = \frac{1}{2}\ln \left( \frac{1 + x}{1 - x} \right)et on peut donc émuler la fonction avec :

js
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 GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
atanh

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Voir aussi