aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/math/log
diff options
context:
space:
mode:
authorjulieng <julien.gattelier@gmail.com>2021-08-03 08:03:23 +0200
committerSphinxKnight <SphinxKnight@users.noreply.github.com>2021-09-03 08:08:25 +0200
commitbf8e099b9c8b3c60d60b3712b4fc97b052c39887 (patch)
treec101746d082c9581c94f5937519c7d0e2f4af8cb /files/fr/web/javascript/reference/global_objects/math/log
parent844f5103992238c0c23203286dad16a466e89c97 (diff)
downloadtranslated-content-bf8e099b9c8b3c60d60b3712b4fc97b052c39887.tar.gz
translated-content-bf8e099b9c8b3c60d60b3712b4fc97b052c39887.tar.bz2
translated-content-bf8e099b9c8b3c60d60b3712b4fc97b052c39887.zip
convert content to md
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/math/log')
-rw-r--r--files/fr/web/javascript/reference/global_objects/math/log/index.md121
1 files changed, 49 insertions, 72 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/math/log/index.md b/files/fr/web/javascript/reference/global_objects/math/log/index.md
index 25d7a48e8b..14c55bd91d 100644
--- a/files/fr/web/javascript/reference/global_objects/math/log/index.md
+++ b/files/fr/web/javascript/reference/global_objects/math/log/index.md
@@ -9,96 +9,73 @@ tags:
translation_of: Web/JavaScript/Reference/Global_Objects/Math/log
original_slug: Web/JavaScript/Reference/Objets_globaux/Math/log
---
-<div>{{JSRef}}</div>
+{{JSRef}}
-<p>La fonction <code><strong>Math.log()</strong></code> renvoie le logarithme naturel (aussi appelé logarithme népérien) d'un nombre, défini par :</p>
+La fonction **`Math.log()`** renvoie le logarithme naturel (aussi appelé logarithme népérien) d'un nombre, défini par :
-<p><math display="block"><semantics><mrow><mo>∀</mo><mi>x</mi><mo>&gt;</mo><mn>0</mn><mo>,</mo><mstyle mathvariant="monospace"><mrow><mo lspace="0em" rspace="thinmathspace">Math.log</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><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mtext>le seul </mtext><mspace width="thickmathspace"></mspace><mi>y</mi><mspace width="thickmathspace"></mspace><mtext>tel que</mtext><mspace width="thickmathspace"></mspace><msup><mi>e</mi><mi>y</mi></msup><mo>=</mo><mi>x</mi></mrow><annotation encoding="TeX">\forall x &gt; 0, \mathtt{\operatorname{Math.log}(x)} = \ln(x) = \text{the unique} \; y \; \text{such that} \; e^y = x</annotation></semantics></math></p>
+<math display="block"><semantics><mrow><mo>∀</mo><mi>x</mi><mo>></mo><mn>0</mn><mo>,</mo><mstyle mathvariant="monospace"><mrow><mo lspace="0em" rspace="thinmathspace">Math.log</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><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mtext>le seul </mtext><mspace width="thickmathspace"></mspace><mi>y</mi><mspace width="thickmathspace"></mspace><mtext>tel que</mtext><mspace width="thickmathspace"></mspace><msup><mi>e</mi><mi>y</mi></msup><mo>=</mo><mi>x</mi></mrow><annotation encoding="TeX">\forall x > 0, \mathtt{\operatorname{Math.log}(x)} = \ln(x) = \text{the unique} \; y \; \text{such that} \; e^y = x</annotation></semantics></math>
-<div>{{EmbedInteractiveExample("pages/js/math-log.html")}}</div>
+{{EmbedInteractiveExample("pages/js/math-log.html")}}
-<h2 id="Syntaxe">Syntaxe</h2>
+## Syntaxe
-<pre class="syntaxbox">Math.log(<em>x</em>)</pre>
+ Math.log(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>Le logarithme naturelle de la valeur passée en argument. Si cette valeur est négative, c'est {{jsxref("NaN")}} qui est renvoyé.</p>
+Le logarithme naturelle de la valeur passée en argument. Si cette valeur est négative, c'est {{jsxref("NaN")}} qui est renvoyé.
-<h2 id="Description">Description</h2>
+## Description
-<p>Si la valeur de l'argument est négative, la valeur renvoyée sera {{jsxref("NaN")}}. Si la valeur de l'argument est <code>0</code>, la valeur de retour sera {{jsxref("Number.NEGATIVE_INFINITY", "-Infinity")}}.</p>
+Si la valeur de l'argument est négative, la valeur renvoyée sera {{jsxref("NaN")}}. Si la valeur de l'argument est `0`, la valeur de retour sera {{jsxref("Number.NEGATIVE_INFINITY", "-Infinity")}}.
-<p><code>log()</code> est une méthode statique de <code>Math</code>, elle doit toujours être utilisée avec la syntaxe <code>Math.log()</code>, elle ne doit pas être utilisée à partir d'un autre objet qui aurait été créé (<code>Math</code> n'est pas un constructeur). Si on veut utiliser les constantes données par les logarithmes naturels de 2 ou 10, on pourra utiliser les constantes {{jsxref("Math.LN2")}} ou {{jsxref("Math.LN10")}}. De même pour les logarithmes en base 2 ou en base 10, on pourra utiliser {{jsxref("Math.log2()")}} or {{jsxref("Math.log10()")}}.</p>
+`log()` est une méthode statique de `Math`, elle doit toujours être utilisée avec la syntaxe `Math.log()`, elle ne doit pas être utilisée à partir d'un autre objet qui aurait été créé (`Math` n'est pas un constructeur). Si on veut utiliser les constantes données par les logarithmes naturels de 2 ou 10, on pourra utiliser les constantes {{jsxref("Math.LN2")}} ou {{jsxref("Math.LN10")}}. De même pour les logarithmes en base 2 ou en base 10, on pourra utiliser {{jsxref("Math.log2()")}} or {{jsxref("Math.log10()")}}.
-<h2 id="Exemples">Exemples</h2>
+## Exemples
-<h3 id="Utiliser_Math.log()">Utiliser <code>Math.log()</code></h3>
+### Utiliser `Math.log()`
-<pre class="brush:js">Math.log(-1); // NaN, valeur en dehors de l'intervalle de définition
+```js
+Math.log(-1); // NaN, valeur en dehors de l'intervalle de définition
Math.log(0); // -Infinity
Math.log(1); // 0
-Math.log(10); // 2.302585092994046</pre>
+Math.log(10); // 2.302585092994046
+```
-<h3 id="Utiliser_Math.log_pour_construire_un_logarithme_sur_une_autre_base">Utiliser <code>Math.log</code> pour construire un logarithme sur une autre base</h3>
+### Utiliser `Math.log` pour construire un logarithme sur une autre base
-<p>La fonction suivante renvoie le logarithme de <code>y</code> en base <code>x</code> (c'est-à-dire log<sub>x</sub> y):</p>
+La fonction suivante renvoie le logarithme de `y` en base `x` (c'est-à-dire log<sub>x</sub> y):
-<pre class="brush:js">function getBaseLog(x, y) {
+```js
+function getBaseLog(x, y) {
return Math.log(y) / Math.log(x);
-}</pre>
-
-<p>Si on exécute <code>getBaseLog(10, 1000)</code>, on obtiendra <code>2.9999999999999996</code> en raison de l'arrondi du à la représentation en nombre flottant (le résultat exact étant 3).</p>
-
-<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('ES1')}}</td>
- <td>{{Spec2('ES1')}}</td>
- <td>Définition initiale. Implémentée avec JavaScript 1.0.</td>
- </tr>
- <tr>
- <td>{{SpecName('ES5.1', '#sec-15.8.2.10', 'Math.log')}}</td>
- <td>{{Spec2('ES5.1')}}</td>
- <td></td>
- </tr>
- <tr>
- <td>{{SpecName('ES6', '#sec-math.log', 'Math.log')}}</td>
- <td>{{Spec2('ES6')}}</td>
- <td></td>
- </tr>
- <tr>
- <td>{{SpecName('ESDraft', '#sec-math.log', 'Math.log')}}</td>
- <td>{{Spec2('ESDraft')}}</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
-
-<p>{{Compat("javascript.builtins.Math.log")}}</p>
-
-<h2 id="Voir_aussi">Voir aussi</h2>
-
-<ul>
- <li>{{jsxref("Math.exp()")}}</li>
- <li>{{jsxref("Math.log1p()")}}</li>
- <li>{{jsxref("Math.log10()")}}</li>
- <li>{{jsxref("Math.log2()")}}</li>
- <li>{{jsxref("Math.pow()")}}</li>
-</ul>
+}
+```
+
+Si on exécute `getBaseLog(10, 1000)`, on obtiendra `2.9999999999999996` en raison de l'arrondi du à la représentation en nombre flottant (le résultat exact étant 3).
+
+## Spécifications
+
+| Spécification | État | Commentaires |
+| -------------------------------------------------------------------- | ---------------------------- | ----------------------------------------------------- |
+| {{SpecName('ES1')}} | {{Spec2('ES1')}} | Définition initiale. Implémentée avec JavaScript 1.0. |
+| {{SpecName('ES5.1', '#sec-15.8.2.10', 'Math.log')}} | {{Spec2('ES5.1')}} | |
+| {{SpecName('ES6', '#sec-math.log', 'Math.log')}} | {{Spec2('ES6')}} | |
+| {{SpecName('ESDraft', '#sec-math.log', 'Math.log')}} | {{Spec2('ESDraft')}} | |
+
+## Compatibilité des navigateurs
+
+{{Compat("javascript.builtins.Math.log")}}
+
+## Voir aussi
+
+- {{jsxref("Math.exp()")}}
+- {{jsxref("Math.log1p()")}}
+- {{jsxref("Math.log10()")}}
+- {{jsxref("Math.log2()")}}
+- {{jsxref("Math.pow()")}}