aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/javascript/reference/global_objects/math/log1p/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/de/web/javascript/reference/global_objects/math/log1p/index.html')
-rw-r--r--files/de/web/javascript/reference/global_objects/math/log1p/index.html102
1 files changed, 102 insertions, 0 deletions
diff --git a/files/de/web/javascript/reference/global_objects/math/log1p/index.html b/files/de/web/javascript/reference/global_objects/math/log1p/index.html
new file mode 100644
index 0000000000..a63eab6b6f
--- /dev/null
+++ b/files/de/web/javascript/reference/global_objects/math/log1p/index.html
@@ -0,0 +1,102 @@
+---
+title: Math.log1p()
+slug: Web/JavaScript/Reference/Global_Objects/Math/log1p
+tags:
+ - ECMAScript 2015
+ - JavaScript
+ - Math
+ - Method
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/log1p
+---
+<div>{{JSRef}}</div>
+
+<p>Die <strong><code>Math.log1p()</code></strong> Funktion gibt den natürlichen Logarithmus (Logarithmus zur Basis {{jsxref("Math.E", "e")}}) von 1 + x zurück. Das bedeutet</p>
+
+<p><math display="block"><semantics><mrow><mo>∀</mo><mi>x</mi><mo>&gt;</mo><mo>-</mo><mn>1</mn><mo>,</mo><mstyle mathvariant="monospace"><mrow><mo lspace="0em" rspace="thinmathspace">Math.log1p</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><mo lspace="0em" rspace="0em">ln</mo><mo stretchy="false">(</mo><mn>1</mn><mo>+</mo><mi>x</mi><mo stretchy="false">)</mo></mrow><annotation encoding="TeX">\forall x &gt; -1, \mathtt{\operatorname{Math.log1p}(x)} = \ln(1 + x)</annotation></semantics></math></p>
+
+<div>{{EmbedInteractiveExample("pages/js/math-log1p.html")}}</div>
+
+
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox"><code>Math.log1p(<var>x</var>)</code></pre>
+
+<h3 id="Parameter">Parameter</h3>
+
+<dl>
+ <dt><code>x</code></dt>
+ <dd>Eine Zahl.</dd>
+</dl>
+
+<h3 id="Rückgabewert">Rückgabewert</h3>
+
+<p>Den natürliche Logarithmus (zur Basis {{jsxref("Math.E", "e")}}) von 1 plus der gegebenen Zahl. Wenn die Zahl kleiner als <strong>-1</strong> ist, wird {{jsxref("NaN")}} zurückgegeben.</p>
+
+<h2 id="Beschreibung">Beschreibung</h2>
+
+<p>Für sehr kleine Zahlen für <code>x</code> kann das Addieren mit 1 zu verlusten in der Präzision führen. Die Zahlen in JavaScript haben eine Genauigkeit von 15 Stellen. <code> 1 + 1e-15 = 1.000000000000001</code>, aber <code>1 + 1e-16 = 1.000000000000000</code> und damit exakt <code>1</code><code>.0</code> in dieser Arithmetik, weil Ziffern nach der 15 Stelle gerundet werden.</p>
+
+<p>Wenn <code>log(1 + x)</code> berechnet wird, bekommt man ein Ergebnis sehr na an <code>x</code>, wenn <code>x</code> klein ist (das ist der Grund, warum es 'natürlicher' Logarithmus heißt). Wenn <code>Math.log(1 + 1.1111111111e-15)</code> berechnet wird sollte man ein Ergebnis nah an <code>1.1111111111e-15</code> bekommt. Stattdessen berechnet man den Logarithmus von <code><span style="line-height: 1.5;">1.00000000000000111022</span></code><span style="line-height: 1.5;"> (die Rundung geschieht im Binärsystem und ist manchmal unschön) un erhält das Ergebnis <code>1.11022...e-15</code> mit nur 3 korrekten Stellen. Wenn stattdessen <code>Math.log1p(</code></span><code>1.1111111111e-15</code><span style="line-height: 1.5;"><code>)</code> berechnet wird, bekommt man ein besseres Ergebnis von <code>1.1111111110999995e-15</code> mit 15 korrekten Stellen in der Präzision (aktuell 16 in diesem Fall).</span></p>
+
+<p>Wenn der Wert von <code>x</code> kleiner als -1 ist, gibt die Funktion immer den Wert {{jsxref("NaN")}} zurück.</p>
+
+<p>Weil <code>log1p()</code> eine statische Funktion von <code>Math</code> ist, wird es immer als <code>Math.log1p()</code> eingesetzt<code>,</code> jedoch nicht als Methode eines erzeugten <code>Math</code> Objektes (<code>Math</code> ist kein Konstruktor).</p>
+
+<h2 id="Beispiele">Beispiele</h2>
+
+<h3 id="Einsatz_von_Math.log1p()">Einsatz von <code>Math.log1p()</code></h3>
+
+<pre class="brush: js">Math.log1p(1); // 0.6931471805599453
+Math.log1p(0); // 0
+Math.log1p(-1); // -Infinity
+Math.log1p(-2); // NaN
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>Diese Funktion kann folgendermaßen emuliert werden:</p>
+
+<pre class="brush: js">Math.log1p = Math.log1p || function(x) {
+ return Math.log(1 + x);
+};
+</pre>
+
+<h2 id="Spezifikationen">Spezifikationen</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Spezifikation</th>
+ <th scope="col">Status</th>
+ <th scope="col">Kommentar</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-math.log1p', 'Math.log1p')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initiale Definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-math.log1p', 'Math.log1p')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browserkompatibilität">Browserkompatibilität</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Math.log1p")}}</p>
+
+<h2 id="Siehe_auch">Siehe auch</h2>
+
+<ul>
+ <li>{{jsxref("Math.exp()")}}</li>
+ <li>{{jsxref("Math.log()")}}</li>
+ <li>{{jsxref("Math.log10()")}}</li>
+ <li>{{jsxref("Math.log2()")}}</li>
+ <li>{{jsxref("Math.pow()")}}</li>
+</ul>