From 4b1a9203c547c019fc5398082ae19a3f3d4c3efe Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:15 -0500 Subject: initial commit --- .../reference/global_objects/math/tanh/index.html | 93 ++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 files/de/web/javascript/reference/global_objects/math/tanh/index.html (limited to 'files/de/web/javascript/reference/global_objects/math/tanh') diff --git a/files/de/web/javascript/reference/global_objects/math/tanh/index.html b/files/de/web/javascript/reference/global_objects/math/tanh/index.html new file mode 100644 index 0000000000..7bfa025f4e --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/math/tanh/index.html @@ -0,0 +1,93 @@ +--- +title: Math.tanh() +slug: Web/JavaScript/Reference/Global_Objects/Math/tanh +tags: + - ECMAScript 2015 + - JavaScript + - Math + - Method + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Math/tanh +--- +
{{JSRef}}
+ +

Die Math.tanh() Funktion gibt den Tangens Hyperbolicus einer Zahl zurück. Dieser kann folgendermaßen errechnet werden:

+ +

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

Parameter

+ +
+
x
+
Eine Zahl.
+
+ +

Rückgabewert

+ +

Den Tangens Hyperbolicus der übergebenen Zahl.

+ +

Beschreibung

+ +

Weil tanh() eine statische Funktion von Math ist, wird es immer als Math.tanh() eingesetzt, jedoch nicht als Methode eines erzeugten Math Objektes (Math ist kein Konstruktor).

+ +

Beispiele

+ +

Einsatz von Math.tanh()

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

Polyfill

+ +

Diese Funktion kann mit Hilfe der Funktion {{jsxref("Math.exp()")}} emuliert werden:

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

Spezifikationen

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

Browserkompatibilität

+ + + +

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

+ +

Siehe auch

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