diff options
| author | julieng <julien.gattelier@gmail.com> | 2021-08-03 08:03:23 +0200 |
|---|---|---|
| committer | SphinxKnight <SphinxKnight@users.noreply.github.com> | 2021-09-03 08:08:25 +0200 |
| commit | bf8e099b9c8b3c60d60b3712b4fc97b052c39887 (patch) | |
| tree | c101746d082c9581c94f5937519c7d0e2f4af8cb /files/fr/web/javascript/reference/global_objects/math/sqrt | |
| parent | 844f5103992238c0c23203286dad16a466e89c97 (diff) | |
| download | translated-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/sqrt')
| -rw-r--r-- | files/fr/web/javascript/reference/global_objects/math/sqrt/index.md | 103 |
1 files changed, 39 insertions, 64 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/math/sqrt/index.md b/files/fr/web/javascript/reference/global_objects/math/sqrt/index.md index 6b309e4d01..8af569dd19 100644 --- a/files/fr/web/javascript/reference/global_objects/math/sqrt/index.md +++ b/files/fr/web/javascript/reference/global_objects/math/sqrt/index.md @@ -9,86 +9,61 @@ tags: translation_of: Web/JavaScript/Reference/Global_Objects/Math/sqrt original_slug: Web/JavaScript/Reference/Objets_globaux/Math/sqrt --- -<div>{{JSRef}}</div> +{{JSRef}} -<p>La fonction <code><strong>Math.sqrt()</strong></code> renvoie la racine carrée d'un nombre. Cette fonction est définie par :</p> +La fonction **`Math.sqrt()`** renvoie la racine carrée d'un nombre. Cette fonction est définie par : -<p><math display="block"><semantics><mrow><mo>∀</mo><mi>x</mi><mo>≥</mo><mn>0</mn><mo>,</mo><mstyle mathvariant="monospace"><mrow><mi>M</mi><mi>a</mi><mi>t</mi><mi>h</mi><mo>.</mo><mi>s</mi><mi>q</mi><mi>r</mi><mi>t</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><msqrt><mi>x</mi></msqrt><mo>=</mo><mtext>l'unique</mtext><mspace width="thickmathspace"></mspace><mi>y</mi><mo>≥</mo><mn>0</mn><mspace width="thickmathspace"></mspace><mtext>tel que</mtext><mspace width="thickmathspace"></mspace><msup><mi>y</mi><mn>2</mn></msup><mo>=</mo><mi>x</mi></mrow><annotation encoding="TeX">\forall x \geq 0, \mathtt{Math.sqrt(x)} = \sqrt{x} = \text{the unique} \; y \geq 0 \; \text{such that} \; y^2 = 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><mi>M</mi><mi>a</mi><mi>t</mi><mi>h</mi><mo>.</mo><mi>s</mi><mi>q</mi><mi>r</mi><mi>t</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><msqrt><mi>x</mi></msqrt><mo>=</mo><mtext>l'unique</mtext><mspace width="thickmathspace"></mspace><mi>y</mi><mo>≥</mo><mn>0</mn><mspace width="thickmathspace"></mspace><mtext>tel que</mtext><mspace width="thickmathspace"></mspace><msup><mi>y</mi><mn>2</mn></msup><mo>=</mo><mi>x</mi></mrow><annotation encoding="TeX">\forall x \geq 0, \mathtt{Math.sqrt(x)} = \sqrt{x} = \text{the unique} \; y \geq 0 \; \text{such that} \; y^2 = x</annotation></semantics></math> -<div>{{EmbedInteractiveExample("pages/js/math-sqrt.html")}}</div> +{{EmbedInteractiveExample("pages/js/math-sqrt.html")}} -<h2 id="Syntaxe">Syntaxe</h2> +## Syntaxe -<pre class="syntaxbox">Math.sqrt(<var>x</var>)</pre> + Math.sqrt(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 racine carrée du nombre passé en argument. Si le nombre fourni est négatif, c'est {{jsxref("NaN")}} qui sera renvoyé.</p> +La racine carrée du nombre passé en argument. Si le nombre fourni est négatif, c'est {{jsxref("NaN")}} qui sera renvoyé. -<h2 id="Description">Description</h2> +## Description -<p>Si la valeur de <code>x</code> est négative, <code>sqrt</code> renverra {{jsxref("NaN")}}.</p> +Si la valeur de `x` est négative, `sqrt` renverra {{jsxref("NaN")}}. -<p><code>sqrt()</code> est une méthode statique de <code>Math</code>, elle doit être utilisée avec la syntaxe <code>Math.sqrt()</code>, elle ne doit pas être appelée comme méthode d'un autre objet qui aurait été créé (<code>Math</code> n'est pas un constructeur).</p> +`sqrt()` est une méthode statique de `Math`, elle doit être utilisée avec la syntaxe `Math.sqrt()`, elle ne doit pas être appelée comme méthode d'un autre objet qui aurait été créé (`Math` n'est pas un constructeur). -<h2 id="Exemples">Exemples</h2> +## Exemples -<pre class="brush:js">Math.sqrt(9); // 3 +```js +Math.sqrt(9); // 3 Math.sqrt(2); // 1.414213562373095 Math.sqrt(1); // 1 Math.sqrt(0); // 0 Math.sqrt(-1); // NaN -Math.sqrt(-0); // -0</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('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.17', 'Math.sqrt')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-math.sqrt', 'Math.sqrt')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-math.sqrt', 'Math.sqrt')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> - -<p>{{Compat("javascript.builtins.Math.sqrt")}}</p> - -<h2 id="Voir_aussi">Voir aussi</h2> - -<ul> - <li>{{jsxref("Math.cbrt()")}}</li> - <li>{{jsxref("Math.exp()")}}</li> - <li>{{jsxref("Math.log()")}}</li> - <li>{{jsxref("Math.pow()")}}</li> -</ul> +Math.sqrt(-0); // -0 +``` + +## 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.17', 'Math.sqrt')}} | {{Spec2('ES5.1')}} | | +| {{SpecName('ES6', '#sec-math.sqrt', 'Math.sqrt')}} | {{Spec2('ES6')}} | | +| {{SpecName('ESDraft', '#sec-math.sqrt', 'Math.sqrt')}} | {{Spec2('ESDraft')}} | | + +## Compatibilité des navigateurs + +{{Compat("javascript.builtins.Math.sqrt")}} + +## Voir aussi + +- {{jsxref("Math.cbrt()")}} +- {{jsxref("Math.exp()")}} +- {{jsxref("Math.log()")}} +- {{jsxref("Math.pow()")}} |
