aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/math/expm1/index.html
blob: 713f5754521024dc98bb7f4b597f6f53e9a03ca9 (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
---
title: Math.expm1()
slug: Web/JavaScript/Reference/Global_Objects/Math/expm1
tags:
  - ECMAScript6
  - JavaScript
  - Math
  - Méthode
  - Reference
  - polyfill
translation_of: Web/JavaScript/Reference/Global_Objects/Math/expm1
original_slug: Web/JavaScript/Reference/Objets_globaux/Math/expm1
---
<div>{{JSRef}}</div>

<p>La fonction <code><strong>Math.expm1()</strong></code> renvoie<code> e<sup>x</sup></code> - 1, avec <code>x</code> l'argument donné et {{jsxref("Objets_globaux/Math/E","e")}} la base du logarithme nepérien.</p>

<div>{{EmbedInteractiveExample("pages/js/math-expm1.html")}}</div>

<p class="hidden">Le code source de cet exemple interactif est disponible dans un dépôt GitHub. Si vous souhaitez contribuez à ces exemples, n'hésitez pas à cloner <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> et à envoyer une <em>pull request</em> !</p>

<h2 id="Syntaxe">Syntaxe</h2>

<pre class="syntaxbox">Math.expm1(<var>x</var>)</pre>

<h3 id="Paramètres">Paramètres</h3>

<dl>
 <dt><code>x</code></dt>
 <dd>Un nombre.</dd>
</dl>

<h3 id="Valeur_de_retour">Valeur de retour</h3>

<p>Un nombre qui représente <code>e<sup>x</sup>- 1</code><code>x</code> est la valeur passée en argument et <code>e<sup>x</sup></code> l'exponentielle du nombre.</p>

<h2 id="Description">Description</h2>

<p><code>expm1()</code> étant une méthode statique de <code>Math</code>, il faut utiliser <code>Math.expm1()</code>et non pas la méthode d'un autre objet qui aurait été créé sur mesure (<code>Math </code>n'est pas un constructeur).</p>

<h2 id="Exemple">Exemple</h2>

<h3 id="Utiliser_Math.expm1()">Utiliser <code>Math.expm1()</code></h3>

<pre class="brush:js">Math.expm1(-1); // -0.6321205588285577
Math.expm1(0);  // 0
Math.expm1(1);  // 1.718281828459045</pre>

<h2 id="Prothèse_d'émulation_(polyfill)">Prothèse d'émulation (<em>polyfill</em>)</h2>

<p>Cette fonction peut être émulée en utilisant la fonction {{jsxref("Objets_globaux/Math/exp", "Math.exp()")}} :</p>

<pre class="brush: js">Math.expm1 = Math.expm1 || function(x) {
    return Math.exp(x) - 1;
};</pre>

<h2 id="Spécifications">Spécifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Spécification</th>
   <th scope="col">État</th>
   <th scope="col">Commentaires</th>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-math.expm1', 'Math.expm1')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td>Définition initiale.</td>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-math.expm1', 'Math.expm1')}}</td>
   <td>{{Spec2('ESDraft')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>

<p>{{Compat("javascript.builtins.Math.expm1")}}</p>

<h2 id="Voir_aussi">Voir aussi</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>