From bf8e099b9c8b3c60d60b3712b4fc97b052c39887 Mon Sep 17 00:00:00 2001 From: julieng Date: Tue, 3 Aug 2021 08:03:23 +0200 Subject: convert content to md --- .../reference/global_objects/math/ln2/index.md | 89 ++++++++-------------- 1 file changed, 31 insertions(+), 58 deletions(-) (limited to 'files/fr/web/javascript/reference/global_objects/math/ln2') diff --git a/files/fr/web/javascript/reference/global_objects/math/ln2/index.md b/files/fr/web/javascript/reference/global_objects/math/ln2/index.md index 0a7fc56029..25019b09ca 100644 --- a/files/fr/web/javascript/reference/global_objects/math/ln2/index.md +++ b/files/fr/web/javascript/reference/global_objects/math/ln2/index.md @@ -9,74 +9,47 @@ tags: translation_of: Web/JavaScript/Reference/Global_Objects/Math/LN2 original_slug: Web/JavaScript/Reference/Objets_globaux/Math/LN2 --- -
{{JSRef}}
+{{JSRef}} -

La propriété Math.LN2 représente le logarithme naturel de 2, environ 0.693:

+La propriété **`Math.LN2`** représente le logarithme naturel de 2, environ 0.693: -

Math.LN2=ln(2)0.693\mathtt{\mi{Math.LN2}} = \ln(2) \approx 0.693

+Math.LN2=ln(2)0.693\mathtt{\mi{Math.LN2}} = \ln(2) \approx 0.693 -
{{EmbedInteractiveExample("pages/js/math-ln2.html")}}
+{{EmbedInteractiveExample("pages/js/math-ln2.html")}}{{js_property_attributes(0,0,0)}} +## Description +`LN2` est une propriété statique de l'objet `Math`, il doit toujours être utilisé avec la syntaxe `Math.LN2`, et non pas être utilisé comme la propriété d'un objet qui aurait été créé (`Math` n'est pas un constructeur). -
{{js_property_attributes(0,0,0)}}
+## Exemples -

Description

+### Utiliser `Math.LN2` -

LN2 est une propriété statique de l'objet Math, il doit toujours être utilisé avec la syntaxe Math.LN2, et non pas être utilisé comme la propriété d'un objet qui aurait été créé (Math n'est pas un constructeur).

+La fonction suivante renvoie le logarithme en base 2 d'un nombre en utilisant la valeur de `Math.LN2` : -

Exemples

+```js +function getLog2(x) { + return Math.log(x) / Math.LN2; +} -

Utiliser Math.LN2

+getLog2(256); // 8 +``` -

La fonction suivante renvoie le logarithme en base 2 d'un nombre en utilisant la valeur de Math.LN2 :

+## Spécifications -
function getLog2(x) {
-  return Math.log(x) / Math.LN2;
-}
+| Spécification                                                        | Statut                       | Commentaires                                          |
+| -------------------------------------------------------------------- | ---------------------------- | ----------------------------------------------------- |
+| {{SpecName('ES1')}}                                             | {{Spec2('ES1')}}         | Définition initiale. Implémentée avec JavaScript 1.0. |
+| {{SpecName('ES5.1', '#sec-15.8.1.3', 'Math.LN2')}} | {{Spec2('ES5.1')}}     |                                                       |
+| {{SpecName('ES6', '#sec-math.ln2', 'Math.LN2')}}     | {{Spec2('ES6')}}         |                                                       |
+| {{SpecName('ESDraft', '#sec-math.ln2', 'Math.LN2')}} | {{Spec2('ESDraft')}} |                                                       |
+
+## Compatibilité des navigateurs
+
+{{Compat("javascript.builtins.Math.LN2")}}
+
+## Voir aussi
 
-getLog2(256); // 8
- -

Spécifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpécificationStatutCommentaires
{{SpecName('ES1')}}{{Spec2('ES1')}}Définition initiale. Implémentée avec JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.1.3', 'Math.LN2')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.ln2', 'Math.LN2')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-math.ln2', 'Math.LN2')}}{{Spec2('ESDraft')}} 
- -

Compatibilité des navigateurs

- -

{{Compat("javascript.builtins.Math.LN2")}}

- -

Voir aussi

- - +- {{jsxref("Math.exp()")}} +- {{jsxref("Math.log()")}} +- {{jsxref("Math.log2()")}} -- cgit v1.2.3-54-g00ecf