From 39f2114f9797eb51994966c6bb8ff1814c9a4da8 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:36:08 +0100 Subject: unslug fr: move --- .../reference/global_objects/math/log10/index.html | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 files/fr/web/javascript/reference/global_objects/math/log10/index.html (limited to 'files/fr/web/javascript/reference/global_objects/math/log10/index.html') diff --git a/files/fr/web/javascript/reference/global_objects/math/log10/index.html b/files/fr/web/javascript/reference/global_objects/math/log10/index.html new file mode 100644 index 0000000000..724247091b --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/math/log10/index.html @@ -0,0 +1,100 @@ +--- +title: Math.log10() +slug: Web/JavaScript/Reference/Objets_globaux/Math/log10 +tags: + - ECMAScript 2015 + - JavaScript + - Math + - Méthode + - Reference + - polyfill +translation_of: Web/JavaScript/Reference/Global_Objects/Math/log10 +--- +
{{JSRef}}
+ +

La fonction Math.log10() renvoie le logarithme en base 10 d'un nombre, donné par la formule :

+ +

x>0,Math.log10(x)=log10(x)=l'unique  ytel que10y=x\forall x > 0, \mathtt{\operatorname{Math.log10}(x)} = \log_10(x) = \text{the unique} \; y \; \text{such that} \; 10^y = x

+ +
{{EmbedInteractiveExample("pages/js/math-log10.html")}}
+ + + +

Syntaxe

+ +
Math.log10(x)
+ +

Paramètres

+ +
+
x
+
Un nombre.
+
+ +

Valeur de retour

+ +

Le logarithme en base 10 du nombre passé en argument. Si cette valeur est négative, c'est {{jsxref("NaN")}} qui sera renvoyé.

+ +

Description

+ +

Si la valeur de l'argument est strictement inférieure à 0, la valeur renvoyée à {{jsxref("NaN")}}.

+ +

log10() étant une méthode statique de Math, il faut utiliser Math.log10()et non pas la méthode d'un autre objet qui aurait été créé (Math n'est pas un constructeur). Cette fonction est équivalente à la fonction donnée par Math.log(x) / Math.log(10).

+ +

Exemple

+ +

Utiliser Math.log10()

+ +
Math.log10(2);      // 0.3010299956639812
+Math.log10(1);      // 0
+Math.log10(0);      // -Infinity
+Math.log10(-2);     // NaN
+Math.log10(100000); // 5
+
+ +

Prothèse d'émulation (polyfill)

+ +

Il est possible d'avoir un résultat approximatif avec la fonction suivante :

+ +
Math.log10 = Math.log10 || function(x) {
+  return Math.log(x) * Math.LOG10E;
+};
+
+ +

Spécifications

+ + + + + + + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('ES2015', '#sec-math.log10', 'Math.log10')}}{{Spec2('ES2015')}}Définition initiale.
{{SpecName('ESDraft', '#sec-math.log10', 'Math.log10')}}{{Spec2('ESDraft')}} 
+ +

Compatibilité des navigateurs

+ + + +

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

+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf