aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/javascript/reference/global_objects/math/cbrt/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ru/web/javascript/reference/global_objects/math/cbrt/index.html')
-rw-r--r--files/ru/web/javascript/reference/global_objects/math/cbrt/index.html134
1 files changed, 134 insertions, 0 deletions
diff --git a/files/ru/web/javascript/reference/global_objects/math/cbrt/index.html b/files/ru/web/javascript/reference/global_objects/math/cbrt/index.html
new file mode 100644
index 0000000000..6eccb4f7f2
--- /dev/null
+++ b/files/ru/web/javascript/reference/global_objects/math/cbrt/index.html
@@ -0,0 +1,134 @@
+---
+title: Math.cbrt()
+slug: Web/JavaScript/Reference/Global_Objects/Math/cbrt
+tags:
+ - Experimental
+ - Expérimental(2)
+ - JavaScript
+ - Math
+ - Method
+ - Reference
+ - Référence(2)
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/cbrt
+---
+<div>{{JSRef("Global_Objects", "Math")}}</div>
+
+<h2 id="Summary" name="Summary">Сводка</h2>
+
+<p>Метод <strong><code>Math.cbrt()</code></strong> возвращает кубический корень числа, то есть</p>
+<math display="block"><semantics><mrow><mstyle mathvariant="monospace"><mrow><mi>M</mi><mi>a</mi><mi>t</mi><mi>h</mi><mo>.</mo><mi>c</mi><mi>b</mi><mi>r</mi><mi>t</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><mroot><mi>x</mi><mn>3</mn></mroot><mo>=</mo><mtext>уникальный</mtext><mspace width="thickmathspace"></mspace><mi>y</mi><mspace width="thickmathspace"></mspace><mtext>такой, что</mtext><mspace width="thickmathspace"></mspace><msup><mi>y</mi><mn>3</mn></msup><mo>=</mo><mi>x</mi></mrow><annotation encoding="TeX">\mathtt{Math.cbrt(x)} = \sqrt[3]{x} = \text{уникальный} \; y \; \text{такой, что} \; y^3 = x</annotation></semantics></math><span style='font-family: x-locale-heading-primary,zillaslab,Palatino,"Palatino Linotype",x-locale-heading-secondary,serif; font-size: 2.33333rem; letter-spacing: -0.00278rem;'>Синтаксис</span>
+
+<pre class="syntaxbox"><code>Math.cbrt(<var>x</var>)</code></pre>
+
+<h3 id="Parameters" name="Parameters">Параметры</h3>
+
+<dl>
+ <dt><code>x</code></dt>
+ <dd>Число.</dd>
+</dl>
+
+<h2 id="Description" name="Description">Описание</h2>
+
+<p>Поскольку метод <code>cbrt()</code> является статическим методом объекта <code>Math</code>, вы всегда должны использовать его как <code>Math.cbrt()</code>, а не пытаться вызывать метод на созданном экземпляре объекта <code>Math</code> (поскольку объект <code>Math</code> не является конструктором).</p>
+
+<h2 id="Examples" name="Examples">Примеры</h2>
+
+<h3 id="Example_Using_Math.cbrt" name="Example:_Using_Math.cbrt">Пример: использование метода <code>Math.cbrt()</code></h3>
+
+<pre class="brush: js">Math.cbrt(-1); // -1
+Math.cbrt(0); // 0
+Math.cbrt(1); // 1
+
+Math.cbrt(2); // 1.2599210498948734
+</pre>
+
+<h2 id="Polyfill" name="Polyfill">Полифилл</h2>
+
+<p>Для всех <math><semantics><mrow><mi>x</mi><mo>≥</mo><mn>0</mn></mrow><annotation encoding="TeX">x \geq 0</annotation></semantics></math>, мы имеем <math><semantics><mrow><mroot><mi>x</mi><mn>3</mn></mroot><mo>=</mo><msup><mi>x</mi><mrow><mn>1</mn><mo>/</mo><mn>3</mn></mrow></msup></mrow><annotation encoding="TeX">\sqrt[3]{x} = x^{1/3}</annotation></semantics></math>, так что этот метод может эмулироваться следующим образом:</p>
+
+<pre class="brush: js">Math.cbrt = Math.cbrt || function(x) {
+  if (x === 0 || x === +1 / 0 || x === -1 / 0 || x !== x) {
+    return x;
+  }
+  var a = Math.abs(x);
+  var y = Math.exp(Math.log(a) / 3);
+  // from http://en.wikipedia.org/wiki/Cube_root#Numerical_methods
+ return (x / a) * (y + (a / (y * y) - y) / 3);
+};
+</pre>
+
+<h2 id="Specifications" name="Specifications">Спецификации</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Спецификация</th>
+ <th scope="col">Статус</th>
+ <th scope="col">Комментарии</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-math.cbrt', 'Math.cbrt')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Изначальное определение.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">Совместимость с браузерами</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Возможность</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Базовая поддержка</td>
+ <td>{{CompatChrome("38")}}</td>
+ <td>{{CompatGeckoDesktop("25")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatOpera("25")}}</td>
+ <td>{{CompatSafari("7.1")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Возможность</th>
+ <th>Android</th>
+ <th>Chrome для Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Базовая поддержка</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoMobile("25")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>iOS 8</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also" name="See_also">Смотрите также</h2>
+
+<ul>
+ <li>{{jsxref("Math.pow()")}}</li>
+ <li>{{jsxref("Math.sqrt()")}}</li>
+</ul>