A RetroSearch Logo

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

Search Query:

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

Math.cbrt() - JavaScript | MDN

Math.cbrt()

Baseline Widely available

A função Math.cbrt() retorna a raiz cúbica de um número, isto é

M a t h . c b r t ( x ) = x 3 = y, tal que y3 = x \mathtt{Math.cbrt(x)} = \sqrt[3]{x} = \text{the unique} ; y ; \text{such that} ; y^3 = x Sintaxe Parâmetros Valor de retorno

A raiz cúbica do número fornecido.

Descrição

Porque cbrt() é um método estático de Math, você sempre irá utilizar como Math.cbrt(), ao invés de um método de um objeto Math que você tenha criado (Math não é um construtor).

Exemplos Utilizando Math.cbrt()
Math.cbrt(NaN); // NaN
Math.cbrt(-1); // -1
Math.cbrt(-0); // -0
Math.cbrt(-Infinity); // -Infinity
Math.cbrt(0); // 0
Math.cbrt(1); // 1
Math.cbrt(Infinity); // Infinity
Math.cbrt(null); // 0
Math.cbrt(2); // 1.2599210498948734
Polyfill

Para todo x ≥ 0 x \geq 0 , temos x 3 = x 1 / 3 \sqrt[3]{x} = x^{1/3} , então isto pode ser simulado pela seguinte função:

if (!Math.cbrt) {
  Math.cbrt = function (x) {
    var y = Math.pow(Math.abs(x), 1 / 3);
    return x < 0 ? -y : y;
  };
}
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