A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Math/log10 below:

Math.log10() - JavaScript | MDN

Math.log10()

Baseline Widely available

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

∀ x > 0 , Math.log10 ( x ) = log 10 ( x ) = the unique y such that 10y = x \forall x > 0, \mathtt{\operatorname{Math.log10}(x)} = \log_10(x) = \text{the unique} ; y ; \text{such that} ; 10^y = x Sintaxe Parâmetros Retorno

O logaritmo de base 10 de um número. Caso o número seja negativo, NaN é retornado.

Descrição

Caso o valor de x seja menor que 0, então o retorno será sempre 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 Math.LOG10E que é 1 / 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 Compatibilidade com navegadores Veja também

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4