From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../reference/global_objects/math/tanh/index.html | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 files/pt-br/web/javascript/reference/global_objects/math/tanh/index.html (limited to 'files/pt-br/web/javascript/reference/global_objects/math/tanh/index.html') diff --git a/files/pt-br/web/javascript/reference/global_objects/math/tanh/index.html b/files/pt-br/web/javascript/reference/global_objects/math/tanh/index.html new file mode 100644 index 0000000000..1122f98d69 --- /dev/null +++ b/files/pt-br/web/javascript/reference/global_objects/math/tanh/index.html @@ -0,0 +1,88 @@ +--- +title: Math.tanh() +slug: Web/JavaScript/Reference/Global_Objects/Math/tanh +translation_of: Web/JavaScript/Reference/Global_Objects/Math/tanh +--- +
{{JSRef}}
+ +

A função Math.tanh()  retorna a tangente hiperbólica de um número, que é:

+ +

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

Syntax

+ +
Math.tanh(x)
+ +

Parameters

+ +
+
x
+
Um número.
+
+ +

Return value

+ +

Uma tangente hiperbólica de um número dado.

+ +

Description

+ +

Because tanh() is a static method of Math, you always use it as Math.tanh(), rather than as a method of a Math object you created (Math is not a constructor).

+ +

Examples

+ +

Using Math.tanh()

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

Polyfill

+ +

This can be emulated with the help of the {{jsxref("Math.exp()")}} function:

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

Specifications

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

Browser compatibility

+ + + +

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

+ +

See also

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