From a55b575e8089ee6cab7c5c262a7e6db55d0e34d6 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 14:46:50 +0100 Subject: unslug es: move --- .../reference/global_objects/math/tanh/index.html | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 files/es/web/javascript/reference/global_objects/math/tanh/index.html (limited to 'files/es/web/javascript/reference/global_objects/math/tanh') diff --git a/files/es/web/javascript/reference/global_objects/math/tanh/index.html b/files/es/web/javascript/reference/global_objects/math/tanh/index.html new file mode 100644 index 0000000000..138c466b37 --- /dev/null +++ b/files/es/web/javascript/reference/global_objects/math/tanh/index.html @@ -0,0 +1,95 @@ +--- +title: Math.tanh() +slug: Web/JavaScript/Referencia/Objetos_globales/Math/tanh +tags: + - ECMAScript 2015 + - JavaScript + - Referencia + - metodo +translation_of: Web/JavaScript/Reference/Global_Objects/Math/tanh +--- +
{{JSRef}}
+ +

La funcion Math.tanh() devuelve la hyperbolica tangente de un numero, esto es 

+ +

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")}}
+ +

Sintaxis

+ +
Math.tanh(x)
+ +

Parametros

+ +
+
x
+
Un numero.
+
+ +

Devolver valor

+ +

La hyperbolica tangente del numero obtenido.

+ +

Descripcion

+ +

Porque tanh() es un metodo estatico de Math, siempre se usa como Math.tanh(), en lugar de ser un metodo de Math objeto que creas (Math no es un constructor).

+ +

Ejemplos

+ +

Usando Math.tanh()

+ +
Math.tanh(0);        // 0
+Math.tanh(Infinity); // 1
+Math.tanh(1);        // 0.7615941559557649
+
+ +

Polyfill

+ +

Esto puede ser emulado con ayuda de {{jsxref("Math.exp()")}} funcion:

+ +
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);
+}
+
+ +

Especificaciones

+ + + + + + + + + + + + + + + + + + + +
EspecificacionEstadoComentario
{{SpecName('ES2015', '#sec-math.tanh', 'Math.tanh')}}{{Spec2('ES2015')}} +

Definicion inicial.

+
{{SpecName('ESDraft', '#sec-math.tanh', 'Math.tanh')}}{{Spec2('ESDraft')}} 
+ +

Compatibilidad con navegadores

+ + + +

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

+ +

 

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