From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- .../reference/global_objects/math/cbrt/index.html | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 files/uk/web/javascript/reference/global_objects/math/cbrt/index.html (limited to 'files/uk/web/javascript/reference/global_objects/math/cbrt/index.html') diff --git a/files/uk/web/javascript/reference/global_objects/math/cbrt/index.html b/files/uk/web/javascript/reference/global_objects/math/cbrt/index.html new file mode 100644 index 0000000000..ff889e3849 --- /dev/null +++ b/files/uk/web/javascript/reference/global_objects/math/cbrt/index.html @@ -0,0 +1,100 @@ +--- +title: Math.cbrt() +slug: Web/JavaScript/Reference/Global_Objects/Math/cbrt +tags: + - JavaScript + - Math + - Довідка + - метод +translation_of: Web/JavaScript/Reference/Global_Objects/Math/cbrt +--- +
{{JSRef}}
+ +

Функція Math.cbrt() повертає кубічний корінь числа. Тобто:

+ +

Math.cbrt(x)=x3=такий унікальнийy,для якогоy3=x\mathtt{Math.cbrt(x)} = \sqrt[3]{x} = \text{the unique} \; y \; \text{such that} \; y^3 = x

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

Синтаксис

+ +
Math.cbrt(x)
+ +

Аргументи

+ +
+
x
+
Число.
+
+ +

Результат

+ +

Кубічний корінь даного числа.

+ +

Опис

+ +

Оскільки cbrt() - це статичний метод об'єкту Math, він завжди використовується як Math.cbrt(), а не як метод створеного об'єкту Math  (Math не є конструктором).

+ +

Приклади

+ +

Застосування 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
+
+ +

Поліфіл

+ +

Для всіх x0x \geq 0 маємо x3=x1/3\sqrt[3]{x} = x^{1/3}, тобто цей метод може бути зімітованим за допомогою функції:

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

Специфікації

+ + + + + + + + + + + + + + + + + + + +
СпецифікаціяСтатус документуПримітка
{{SpecName('ES6', '#sec-math.cbrt', 'Math.cbrt')}}{{Spec2('ES6')}}Первинне визначення.
{{SpecName('ESDraft', '#sec-math.cbrt', 'Math.cbrt')}}{{Spec2('ESDraft')}} 
+ +

Підтримка у браузерах

+ + + +

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

+ +

Дивіться також

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