blob: 2d8223041f412780b8c87af62b9669e21ecabfba (
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
|
---
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
---
{{JSRef}}
La fonction **`Math.expm1()`** renvoie` e^x` - 1, avec `x` l'argument donné et {{jsxref("Objets_globaux/Math/E","e")}} la base du logarithme nepérien.
{{EmbedInteractiveExample("pages/js/math-expm1.html")}}
## Syntaxe
Math.expm1(x)
### Paramètres
- `x`
- : Un nombre.
### Valeur de retour
Un nombre qui représente `e^x- 1` où `x` est la valeur passée en argument et `e^x` l'exponentielle du nombre.
## Description
`expm1()` étant une méthode statique de `Math`, il faut utiliser `Math.expm1()`et non pas la méthode d'un autre objet qui aurait été créé sur mesure (`Math `n'est pas un constructeur).
## Exemple
### Utiliser `Math.expm1()`
```js
Math.expm1(-1); // -0.6321205588285577
Math.expm1(0); // 0
Math.expm1(1); // 1.718281828459045
```
## Prothèse d'émulation (_polyfill_)
Cette fonction peut être émulée en utilisant la fonction {{jsxref("Objets_globaux/Math/exp", "Math.exp()")}} :
```js
Math.expm1 = Math.expm1 || function(x) {
return Math.exp(x) - 1;
};
```
## Spécifications
| Spécification | État | Commentaires |
| ---------------------------------------------------------------------------- | ---------------------------- | -------------------- |
| {{SpecName('ES6', '#sec-math.expm1', 'Math.expm1')}} | {{Spec2('ES6')}} | Définition initiale. |
| {{SpecName('ESDraft', '#sec-math.expm1', 'Math.expm1')}} | {{Spec2('ESDraft')}} | |
## Compatibilité des navigateurs
{{Compat("javascript.builtins.Math.expm1")}}
## Voir aussi
- {{jsxref("Math.E")}}
- {{jsxref("Math.exp()")}}
- {{jsxref("Math.log()")}}
- {{jsxref("Math.log10()")}}
- {{jsxref("Math.log1p()")}}
- {{jsxref("Math.log2()")}}
- {{jsxref("Math.pow()")}}
|