A RetroSearch Logo

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

Search Query:

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

Math.cbrt() - JavaScript | MDN

Math.cbrt()

Baseline Widely available

La función Math.cbrt() nos retorna la raíz del cubo del numero, eso es

M a t h . c b r t ( x ) = x 3 = the unique y such that y3 = x \mathtt{Math.cbrt(x)} = \sqrt[3]{x} = \text{un unico} ; y ; \text{de tal manera que} ; y^3 = x Pruébalo
console.log(Math.cbrt(-1));
// Expected output: -1

console.log(Math.cbrt(1));
// Expected output: 1

console.log(Math.cbrt(Infinity));
// Expected output: Infinity

console.log(Math.cbrt(64));
// Expected output: 4
Sintaxis Parametros Valor retornado

La raíz cubica del numero proporcionado

Descripción

Al cbrt() ser un metodo estatico de Math, tu siempre la puedes usar como Math.cbrt(),un metodo de Math que es un objeto que se crea (Math no es un constructor).

Poliformismo

Para x ≥ 0 x \geq 0 , tenemos x 3 = x 1 / 3 \sqrt[3]{x} = x^{1/3} esto puede ser emulado con la siguiente función:

if (!Math.cbrt) {
  Math.cbrt = (function (pow) {
    return function cbrt(x) {
      // Esto asegura que numeros negativos sigan siendo negativos
      return x < 0 ? -pow(-x, 1 / 3) : pow(x, 1 / 3);
    };
  })(Math.pow); // Localiza Math.pow para una mayor eficiencía
}
Ejemplos Usando Math.cbrt()
Math.cbrt(NaN); // NaN
Math.cbrt(-1); // -1
Math.cbrt(-0); // -0
Math.cbrt(-Infinity); // -Infinito
Math.cbrt(0); // 0
Math.cbrt(1); // 1
Math.cbrt(Infinity); // Infinito
Math.cbrt(null); // 0
Math.cbrt(2); // 1.2599210498948732
Especificaciones Compatibilidad con navegadores Puedes leer

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