diff options
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/math/log1p/index.md')
-rw-r--r-- | files/fr/web/javascript/reference/global_objects/math/log1p/index.md | 103 |
1 files changed, 43 insertions, 60 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/math/log1p/index.md b/files/fr/web/javascript/reference/global_objects/math/log1p/index.md index 04913b856c..1ca30ae91d 100644 --- a/files/fr/web/javascript/reference/global_objects/math/log1p/index.md +++ b/files/fr/web/javascript/reference/global_objects/math/log1p/index.md @@ -11,86 +11,69 @@ tags: translation_of: Web/JavaScript/Reference/Global_Objects/Math/log1p original_slug: Web/JavaScript/Reference/Objets_globaux/Math/log1p --- -<div>{{JSRef}}</div> +{{JSRef}} -<p>La fonction <code><strong>Math.log1p()</strong></code> renvoie le logarithme népérien (en base {{jsxref("Math/E","e")}}) d'un nombre +1, donné par la formule :</p> +La fonction **`Math.log1p()`** renvoie le logarithme népérien (en base {{jsxref("Math/E","e")}}) d'un nombre +1, donné par la formule : -<p><math><semantics><mrow><mo>∀</mo><mi>x</mi><mo>></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 > -1, \mathtt{\operatorname{Math.log1p}(x)} = \ln(1 + x)</annotation></semantics></math></p> +<math><semantics><mrow><mo>∀</mo><mi>x</mi><mo>></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 > -1, \mathtt{\operatorname{Math.log1p}(x)} = \ln(1 + x)</annotation></semantics></math> -<div>{{EmbedInteractiveExample("pages/js/math-log1p.html")}}</div> +{{EmbedInteractiveExample("pages/js/math-log1p.html")}} -<h2 id="Syntaxe">Syntaxe</h2> +## Syntaxe -<pre class="syntaxbox">Math.log1p(<var>x</var>)</pre> + Math.log1p(x) -<h3 id="Paramètres">Paramètres</h3> +### Paramètres -<dl> - <dt><code>x</code></dt> - <dd>Un nombre.</dd> -</dl> +- `x` + - : Un nombre. -<h3 id="Valeur_de_retour">Valeur de retour</h3> +### Valeur de retour -<p>La valeur du logarithme naturel de 1 plus l'argument (<code>log(1 + x</code>)). Si l'argument est inférieur à <code>-1</code>, {{jsxref("NaN")}} est renvoyée.</p> +La valeur du logarithme naturel de 1 plus l'argument (`log(1 + x`)). Si l'argument est inférieur à `-1`, {{jsxref("NaN")}} est renvoyée. -<h2 id="Description">Description</h2> +## Description -<p>Si <code>x</code> est strictement inférieur à -1, la valeur renvoyée est {{jsxref("NaN")}}.</p> +Si `x` est strictement inférieur à -1, la valeur renvoyée est {{jsxref("NaN")}}. -<p><code>log1p</code> étant une méthode statique de <code>Math</code>, il faut utiliser <code>Math.<code>log1p</code>()</code> et non pas la méthode d'un autre objet qui aurait été créé (<code>Math</code> n'est pas un constructeur).</p> +`log1p` étant une méthode statique de `Math`, il faut utiliser `Math.log1p()` et non pas la méthode d'un autre objet qui aurait été créé (`Math` n'est pas un constructeur). -<h2 id="Exemple">Exemple</h2> +## Exemple -<h3 id="Utiliser_Math.log1p()">Utiliser <code>Math.log1p()</code></h3> +### Utiliser `Math.log1p()` -<pre class="brush:js">Math.log1p(1); // 0.6931471805599453 +```js +Math.log1p(1); // 0.6931471805599453 Math.log1p(0); // 0 Math.log1p(-1); // -Infinity Math.log1p(-2); // NaN -</pre> +``` -<h2 id="Prothèse_d'émulation_(polyfill)">Prothèse d'émulation (<em>polyfill</em>)</h2> +## Prothèse d'émulation (_polyfill_) -<p>Si cette fonction n'est pas disponible, elle peut être définie grâce au code suivant :</p> +Si cette fonction n'est pas disponible, elle peut être définie grâce au code suivant : -<pre class="brush: js">Math.log1p = Math.log1p || function(x) { +```js +Math.log1p = Math.log1p || function(x) { return Math.log(1 + x); }; -</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('ES2015', '#sec-math.log1p', 'Math.log1p')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Définition initiale.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-math.log1p', 'Math.log1p')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> - -<p>{{Compat("javascript.builtins.Math.log1p")}}</p> - -<h2 id="Voir_aussi">Voir aussi</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> +``` + +## Spécifications + +| Spécification | État | Commentaires | +| ---------------------------------------------------------------------------- | ---------------------------- | -------------------- | +| {{SpecName('ES2015', '#sec-math.log1p', 'Math.log1p')}} | {{Spec2('ES2015')}} | Définition initiale. | +| {{SpecName('ESDraft', '#sec-math.log1p', 'Math.log1p')}} | {{Spec2('ESDraft')}} | | + +## Compatibilité des navigateurs + +{{Compat("javascript.builtins.Math.log1p")}} + +## Voir aussi + +- {{jsxref("Math.exp()")}} +- {{jsxref("Math.log()")}} +- {{jsxref("Math.log10()")}} +- {{jsxref("Math.log2()")}} +- {{jsxref("Math.pow()")}} |