From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../reference/global_objects/math/log10/index.html | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 files/pt-br/web/javascript/reference/global_objects/math/log10/index.html (limited to 'files/pt-br/web/javascript/reference/global_objects/math/log10/index.html') diff --git a/files/pt-br/web/javascript/reference/global_objects/math/log10/index.html b/files/pt-br/web/javascript/reference/global_objects/math/log10/index.html new file mode 100644 index 0000000000..560322b5d0 --- /dev/null +++ b/files/pt-br/web/javascript/reference/global_objects/math/log10/index.html @@ -0,0 +1,137 @@ +--- +title: Math.log10() +slug: Web/JavaScript/Reference/Global_Objects/Math/log10 +translation_of: Web/JavaScript/Reference/Global_Objects/Math/log10 +--- +
{{JSRef}}
+ +

A função Math.log10() retorna o logaritmo de base 10 de um número, que é

+ +

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

+ +

Sintaxe

+ +
Math.log10(x)
+ +

Parâmetros

+ +
+
x
+
Um número.
+
+ +

Retorno

+ +

O logaritmo de base 10 de um número. Caso o número seja negativo, {{jsxref("NaN")}} é retornado.

+ +

Descrição

+ +

Caso o valor de x seja menor que 0, então o retorno será sempre {{jsxref("NaN")}}.

+ +

Por log10() ser um método estático de Math, você sempre o usará como Math.log10(), ao invés de usá-lo como método de um objeto Math criado (Math não é um construtor).

+ +

Esta função é equivalente a Math.log(x) / Math.log(10).  Para log10(e) use a constante {{jsxref("Math.LOG10E")}} que é 1 / {{jsxref("Math.LN10")}}.  

+ +

Exemplos

+ +

Usando Math.log10()

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

Polyfill

+ +

Isso pode ser simulado a partir da seguinte função:

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

Especificações

+ + + + + + + + + + + + + + + + + + + +
EspecificaçãoStatusComentário
{{SpecName('ES6', '#sec-math.log10', 'Math.log10')}}{{Spec2('ES6')}}Initial definition.
{{SpecName('ESDraft', '#sec-math.log10', 'Math.log10')}}{{Spec2('ESDraft')}} 
+ +

Compatibilidade de navegadores

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FuncionalidadeChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suporte básico{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FuncionalidadeAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suporte básico{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
+
+ +

Veja também

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