--- 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 ---
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.
Math.expm1(x)
xUn nombre qui représente e^x- 1 où x est la valeur passée en argument et e^x l'exponentielle du nombre.
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).
Math.expm1()Math.expm1(-1); // -0.6321205588285577 Math.expm1(0); // 0 Math.expm1(1); // 1.718281828459045
Cette fonction peut être émulée en utilisant la fonction {{jsxref("Objets_globaux/Math/exp", "Math.exp()")}} :
Math.expm1 = Math.expm1 || function(x) {
return Math.exp(x) - 1;
};
| 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')}} |
{{Compat("javascript.builtins.Math.expm1")}}