From bf8e099b9c8b3c60d60b3712b4fc97b052c39887 Mon Sep 17 00:00:00 2001 From: julieng Date: Tue, 3 Aug 2021 08:03:23 +0200 Subject: convert content to md --- .../reference/global_objects/math/tanh/index.md | 111 +++++++++------------ 1 file changed, 49 insertions(+), 62 deletions(-) (limited to 'files/fr/web/javascript/reference/global_objects/math/tanh') diff --git a/files/fr/web/javascript/reference/global_objects/math/tanh/index.md b/files/fr/web/javascript/reference/global_objects/math/tanh/index.md index be6fc10fd0..88505bc59d 100644 --- a/files/fr/web/javascript/reference/global_objects/math/tanh/index.md +++ b/files/fr/web/javascript/reference/global_objects/math/tanh/index.md @@ -11,53 +11,56 @@ tags: translation_of: Web/JavaScript/Reference/Global_Objects/Math/tanh original_slug: Web/JavaScript/Reference/Objets_globaux/Math/tanh --- -
{{JSRef}}
+{{JSRef}} -

La fonction Math.tanh() renvoie la tangente hyperbolique d'un nombre définie par :

+La fonction **`Math.tanh()`** renvoie la tangente hyperbolique d'un nombre définie par : -

tanhx=sinhxcoshx=ex-e-xex+e-x=e2x-1e2x+1\tanh x = \frac{\sinh x}{\cosh x} = \frac {e^x - e^{-x}} {e^x + e^{-x}} = \frac{e^{2x} - 1}{e^{2x}+1}

+tanhx=sinhxcoshx=ex-e-xex+e-x=e2x-1e2x+1\tanh x = \frac{\sinh x}{\cosh x} = \frac {e^x - e^{-x}} {e^x + e^{-x}} = \frac{e^{2x} - 1}{e^{2x}+1} -
{{EmbedInteractiveExample("pages/js/math-tanh.html")}}
+{{EmbedInteractiveExample("pages/js/math-tanh.html")}} -

Syntaxe

+## Syntaxe -
Math.tanh(x)
+ Math.tanh(x) -

Paramètres

+### Paramètres -
-
x
-
Un nombre.
-
+- `x` + - : Un nombre. -

Valeur de retour

+### Valeur de retour -

La tangente hyperbolique du nombre fourni en argument.

+La tangente hyperbolique du nombre fourni en argument. -

Description

+## Description -

tanh() est une méthode statique de l'objet Math, elle doit toujours être utilisée avec la syntaxe Math.tanh(), elle ne doit pas être utilisée comme une méthode d'un objet Math qui aurait été instancié (Math n'est pas une constructeur).

+`tanh()` est une méthode statique de l'objet `Math`, elle doit toujours être utilisée avec la syntaxe `Math.tanh()`, elle ne doit pas être utilisée comme une méthode d'un objet `Math` qui aurait été instancié (`Math` n'est pas une constructeur). -

Exemples

+## Exemples -

Utiliser Math.tanh()

+### Utiliser `Math.tanh()` -
Math.tanh(0);        // 0
+```js
+Math.tanh(0);        // 0
 Math.tanh(Infinity); // 1
-Math.tanh(1);        // 0.7615941559557649
+Math.tanh(1); // 0.7615941559557649 +``` -

Prothèse d'émulation (polyfill)

+## Prothèse d'émulation (_polyfill_) -

Cette méthode peut être émulée grâce à la fonction {{jsxref("Objets_globaux/Math/exp", "Math.exp()")}} :

+Cette méthode peut être émulée grâce à la fonction {{jsxref("Objets_globaux/Math/exp", "Math.exp()")}} : -
Math.tanh = Math.tanh || function(x){
+```js
+Math.tanh = Math.tanh || function(x){
   var a = Math.exp(+x), b = Math.exp(-x);
   return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (a + b);
-}
+} +``` -

et si on souhaite n'utiliser qu'un seul appel à {{jsxref("Objets_globaux/Math/exp", "Math.exp()")}} :

+et si on souhaite n'utiliser qu'un seul appel à {{jsxref("Objets_globaux/Math/exp", "Math.exp()")}}` :` -
Math.tanhx = Math.tanhx || function(x) {
+```js
+Math.tanhx = Math.tanhx || function(x) {
   if(x === Infinity) {
     return 1;
   } else if(x === -Infinity) {
@@ -66,40 +69,24 @@ Math.tanh(1);        // 0.7615941559557649
var y = Math.exp(2 * x); return (y - 1) / (y + 1); } -}; - -

Spécifications

- - - - - - - - - - - - - - - - - - - -
SpécificationÉtatCommentaires
{{SpecName('ES2015', '#sec-math.tanh', 'Math.tanh')}}{{Spec2('ES2015')}}Définition initiale.
{{SpecName('ESDraft', '#sec-math.tanh', 'Math.tanh')}}{{Spec2('ESDraft')}} 
- -

Compatibilité des navigateurs

- -

{{Compat("javascript.builtins.Math.tanh")}}

- -

Voir aussi

- - +}; +``` + +## Spécifications + +| Spécification | État | Commentaires | +| ------------------------------------------------------------------------ | ---------------------------- | -------------------- | +| {{SpecName('ES2015', '#sec-math.tanh', 'Math.tanh')}} | {{Spec2('ES2015')}} | Définition initiale. | +| {{SpecName('ESDraft', '#sec-math.tanh', 'Math.tanh')}} | {{Spec2('ESDraft')}} |   | + +## Compatibilité des navigateurs + +{{Compat("javascript.builtins.Math.tanh")}} + +## Voir aussi + +- {{jsxref("Math.acosh()")}} +- {{jsxref("Math.asinh()")}} +- {{jsxref("Math.atanh()")}} +- {{jsxref("Math.cosh()")}} +- {{jsxref("Math.sinh()")}} -- cgit v1.2.3-54-g00ecf