Math : méthode statique tanh()
Baseline
Large disponibilité
Cette fonctionnalité est bien établie et fonctionne sur de nombreux appareils et versions de navigateurs. Elle est disponible sur tous les navigateurs depuis juillet 2015.
La méthode statique Math.tanh() retourne la tangente hyperbolique d'un nombre. Autrement dit,
Exemple interactif
console.log(Math.tanh(-1));
// Sortie attendue : -0.7615941559557649
console.log(Math.tanh(0));
// Sortie attendue : 0
console.log(Math.tanh(Infinity));
// Sortie attendue : 1
console.log(Math.tanh(1));
// Sortie attendue : 0.7615941559557649
Syntaxe
js
Math.tanh(x)
Paramètres
x-
Un nombre.
Valeur de retour
La tangente hyperbolique de x.
Description
Puisque tanh() est une méthode statique de Math, elle doit toujours être utilisée avec la syntaxe Math.tanh(), elle ne doit pas être utilisée comme méthode d'un autre objet Math qui a été instancié (Math n'est pas un constructeur).
Exemples
>Utiliser Math.tanh()
js
Math.tanh(-Infinity); // -1
Math.tanh(-0); // -0
Math.tanh(0); // 0
Math.tanh(1); // 0.7615941559557649
Math.tanh(Infinity); // 1
Spécifications
| Spécification |
|---|
| ECMAScript® 2027 Language Specification> # sec-math.tanh> |
Compatibilité des navigateurs
Voir aussi
- La prothèse d'émulation de
Math.tanhdanscore-js(angl.) - La méthode statique
Math.acosh() - La méthode statique
Math.asinh() - La méthode statique
Math.atanh() - La méthode statique
Math.cosh() - La méthode statique
Math.sinh()