From 1109132f09d75da9a28b649c7677bb6ce07c40c0 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:45 -0500 Subject: initial commit --- .../objetos_globales/math/cbrt/index.html | 96 ++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 files/es/web/javascript/referencia/objetos_globales/math/cbrt/index.html (limited to 'files/es/web/javascript/referencia/objetos_globales/math/cbrt/index.html') diff --git a/files/es/web/javascript/referencia/objetos_globales/math/cbrt/index.html b/files/es/web/javascript/referencia/objetos_globales/math/cbrt/index.html new file mode 100644 index 0000000000..350bc03054 --- /dev/null +++ b/files/es/web/javascript/referencia/objetos_globales/math/cbrt/index.html @@ -0,0 +1,96 @@ +--- +title: Math.cbrt() +slug: Web/JavaScript/Referencia/Objetos_globales/Math/cbrt +translation_of: Web/JavaScript/Reference/Global_Objects/Math/cbrt +--- +
{{JSRef}}
+ +

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

+ +

Math.cbrt(x)=x3=the uniqueysuch thaty3=x\mathtt{Math.cbrt(x)} = \sqrt[3]{x} = \text{un unico} \; y \; \text{de tal manera que} \; y^3 = x

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

Sintaxis

+ +
Math.cbrt(x)
+ +

Parametros

+ +
+
x
+
Un numero
+
+ +

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 x0x \geq 0, tenemos x3=x1/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

+ + + + + + + + + + + + +
Especificación
{{SpecName('ESDraft', '#sec-math.cbrt', 'Math.cbrt')}}
+ +

Compatibilidad

+ + + + + +

and send us a pull request.

+ +

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

+ +

Puedes leer

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