From 39f2114f9797eb51994966c6bb8ff1814c9a4da8 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:36:08 +0100 Subject: unslug fr: move --- .../reference/global_objects/math/cosh/index.html | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 files/fr/web/javascript/reference/global_objects/math/cosh/index.html (limited to 'files/fr/web/javascript/reference/global_objects/math/cosh/index.html') diff --git a/files/fr/web/javascript/reference/global_objects/math/cosh/index.html b/files/fr/web/javascript/reference/global_objects/math/cosh/index.html new file mode 100644 index 0000000000..99d12d6cf0 --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/math/cosh/index.html @@ -0,0 +1,104 @@ +--- +title: Math.cosh() +slug: Web/JavaScript/Reference/Objets_globaux/Math/cosh +tags: + - ECMAScript6 + - JavaScript + - Math + - Méthode + - Reference + - polyfill +translation_of: Web/JavaScript/Reference/Global_Objects/Math/cosh +--- +
{{JSRef}}
+ +

La fonction Math.cosh() renvoie le cosinus hyperbolique d'un nombre, défini par :

+ +

Math.cosh(x)=ex+e-x2\mathtt{\operatorname{Math.cosh(x)}} = \frac{e^x + e^{-x}}{2}

+ +
{{EmbedInteractiveExample("pages/js/math-cosh.html")}}
+ + + +

(Voir la page sur {{jsxref("Objets_globaux/Math/E","e","",1)}})

+ +

Syntaxe

+ +
Math.cosh(x)
+ +

Paramètres

+ +
+
x
+
Un nombre.
+
+ +

Valeur de retour

+ +

Le cosinus hyperbolique du nombre passé en argument.

+ +

Description

+ +

cosh() étant une méthode statique de Math, il faut utiliser Math.cosh() et non pas la méthode d'un objet Math créé sur mesure (Math n'est pas un constructeur).

+ +

Exemple

+ +

Utiliser Math.cosh()

+ +
Math.cosh(0);  // 1
+Math.cosh(1);  // 1.5430806348152437
+Math.cosh(-1); // 1.5430806348152437
+
+ +

Prothèse d'émulation (polyfill)

+ +

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

+ +
Math.cosh = Math.cosh || function(x) {
+    return (Math.exp(x) + Math.exp(-x)) / 2;
+}
+ +

On peut également utiliser un unique appel à {{jsxref("Objets_globaux/Math/exp", "exp()")}} :

+ +
Math.cosh = Math.cosh || function(x) {
+    var y = Math.exp(x);
+    return (y + 1 / y) / 2;
+}
+ +

Spécifications

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

Compatibilité des navigateurs

+ + + +

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

+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf