1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
---
title: Math.expm1()
slug: Web/JavaScript/Reference/Global_Objects/Math/expm1
translation_of: Web/JavaScript/Reference/Global_Objects/Math/expm1
---
<div>{{JSRef}}</div>
<p>The <strong><code>Math.expm1()</code></strong> function returns <code>e<sup>x</sup> - 1</code>, where <code>x</code> is the argument, and {{jsxref("Math.E", "e", "", 1)}} the base of the natural logarithms.</p>
<div>{{EmbedInteractiveExample("pages/js/math-expm1.html")}}</div>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox notranslate"><code>Math.expm1(<var>x</var>)</code></pre>
<h3 id="Parameters">Parameters</h3>
<dl>
<dt><code>x</code></dt>
<dd>Um número.</dd>
</dl>
<h3 id="Return_value">Return value</h3>
<p>Um número representando <code>e<sup>x</sup> - 1</code>, onde <code>e</code> é {{jsxref("Math.E", "Euler's number", "", 1)}} e <code>x</code> ié o argumento.</p>
<h2 id="Description">Description</h2>
<p>Porque <code>expm1()</code> é um método estático de is <code>Math</code>, você sempre o usurá como <code>Math.expm1()</code>, do que como um método de um objeto <code>Math</code> que você criou (<code>Math</code> não é um contrutor).</p>
<h2 id="Polyfill">Polyfill</h2>
<p>This can be emulated with the help of the {{jsxref("Math.exp()")}} function:</p>
<pre class="brush: js notranslate">Math.expm1 = Math.expm1 || function(x) {
return Math.exp(x) - 1;
};
</pre>
<h2 id="Examples">Examples</h2>
<h3 id="Using_Math.expm1">Using <code>Math.expm1()</code></h3>
<pre class="brush: js notranslate">Math.expm1(-1); // -0.6321205588285577
Math.expm1(0); // 0
Math.expm1(1); // 1.718281828459045
</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
</tr>
<tr>
<td>{{SpecName('ESDraft', '#sec-math.expm1', 'Math.expm1')}}</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</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.expm1")}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li>{{jsxref("Math.E")}}</li>
<li>{{jsxref("Math.exp()")}}</li>
<li>{{jsxref("Math.log()")}}</li>
<li>{{jsxref("Math.log10()")}}</li>
<li>{{jsxref("Math.log1p()")}}</li>
<li>{{jsxref("Math.log2()")}}</li>
<li>{{jsxref("Math.pow()")}}</li>
</ul>
|