★ wanayoo — archive 1999 https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Math/cbrtNouvelle recherche | Portail wanayoo

Math.cbrt()

by 1 contributor:

This article is in need of an editorial review.

This translation is incomplete. Please help translate this article from English.

これは Harmony(ECMAScript 6) 提案の一部であり、実験段階の技術です。
この技術の仕様は安定していません。ブラウザ互換性の一覧表を確認してください。またこれらの構文や動作は、仕様変更などにより、新しいバージョンのブラウザでは変更される可能性があるという点に注意してください。

概要

引数として与えた数の立方根を返します。 すなわち

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

構文

Math.cbrt(x)

引数

x
数値

説明

cbrt()はMathオブジェクトの静的なメソッドなので、自ら生成したMathオブジェクトのメソッドとしてではなく、常に、Math.cbrt()として使用するようにしてください(Mathオブジェクトにはコンストラクタがありません)。

例

例: Math.cbrt()を使う

Math.cbrt(-1); // -1
Math.cbrt(0);  // 0
Math.cbrt(1);  // 1

Math.cbrt(2);  // 1.2599210498948734

互換性

すべての x≥0x \geq 0に対して、x3=x1/3\sqrt[3]{x} = x^{1/3}となり、次の関数でエミュレートできます。:

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

仕様

仕様 ステータス コメント
ECMAScript 6 (ECMA-262)
The definition of 'Math.cbrt' in that specification.
勧告候補 Initial definition.

ブラウザ実装状況

機能 Chrome Firefox (Gecko) Internet Explorer Opera Safari
基本サポート 38 25 (25) 未サポート 25 7.1
機能 Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
基本サポート 未サポート 未サポート 25.0 (25) 未サポート 未サポート iOS 8

関連情報

ドキュメントのタグと貢献者

Contributors to this page: shide55
最終更新者: shide55,