--- title: Math.cbrt() slug: Web/JavaScript/Reference/Global_Objects/Math/cbrt tags: - JavaScript - Math - Method - Reference translation_of: Web/JavaScript/Reference/Global_Objects/Math/cbrt ---
{{JSRef}}

Die Funktion Math.cbrt() gibt die Kubikwurzel einer Zahl zurück:

Math.cbrt(x)=x3=das  Ergebnisyso  dassy3=x\mathtt{Math.cbrt(x)} = \sqrt[3]{x} = \text{the unique} \; y \; \text{such that} \; y^3 = x

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

Syntax

Math.cbrt(x)

Parameter

x
Eine Zahl.

Rückgabewert

Die Kubikwurzel der übergebenen Zahl.

Beschreibung

Weil cbrt() eine statische Methode von Math ist, muss diese immer mit Math.cbrt() genutzt werden, ohne dass ein Objekt von Math erstellt wird (Math ist kein Konstruktor).

Beispiele

Verwendung von 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

Für x0x \geq 0 gilt x3=x1/3\sqrt[3]{x} = x^{1/3} so dass diese Funktion wie folgt emuliert werden kann:

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

Spezifikationen

Spezifikation Status Kommentar
{{SpecName('ES6', '#sec-math.cbrt', 'Math.cbrt')}} {{Spec2('ES6')}} Initiale Definition.
{{SpecName('ESDraft', '#sec-math.cbrt', 'Math.cbrt')}} {{Spec2('ESDraft')}}

Browserkompatibilität

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

Siehe auch