CARVIEW |
Select Language
HTTP/2 200
content-type: text/html
x-guploader-uploadid: AAwnv3KJvj2fulIqoiT7i_MkliACPImvFaGeCUTb1buudeCfLw5OKmGRRKi3i7cPFkSYRHsn
cache-control: public, max-age=3600
expires: Sat, 11 Oct 2025 21:38:37 GMT
last-modified: Fri, 10 Oct 2025 01:12:11 GMT
etag: W/"170c7f5e564cb3c3ff330ce89bbff6ba"
x-goog-generation: 1760058731235089
x-goog-metageneration: 1
x-goog-stored-content-encoding: identity
x-goog-stored-content-length: 164839
x-goog-meta-goog-reserved-file-mtime: 1760057110
x-goog-hash: crc32c=6EuYMg==, md5=Fwx/XlZMs8P/Mwzom7/2ug==
x-goog-storage-class: STANDARD
accept-ranges: none
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
alt-svc: clear
referrer-policy: strict-origin-when-cross-origin
x-content-type-options: nosniff
strict-transport-security: max-age=63072000
content-security-policy: default-src 'self'; script-src 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtag/js assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; script-src-elem 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtag/js assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; style-src 'report-sample' 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self'; connect-src 'self' developer.allizom.org bcd.developer.allizom.org bcd.developer.mozilla.org updates.developer.allizom.org updates.developer.mozilla.org https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com https://incoming.telemetry.mozilla.org https://observatory-api.mdn.allizom.net https://observatory-api.mdn.mozilla.net https://api.github.com/search/issues stats.g.doubleclick.net https://api.stripe.com; font-src 'self'; frame-src 'self' interactive-examples.mdn.mozilla.net interactive-examples.mdn.allizom.net mdn.github.io live-samples.mdn.mozilla.net live-samples.mdn.allizom.net *.mdnplay.dev *.mdnyalp.dev *.play.test.mdn.allizom.net https://v2.scrimba.com https://scrimba.com jsfiddle.net www.youtube-nocookie.com codepen.io survey.alchemer.com https://js.stripe.com; img-src 'self' data: *.githubusercontent.com *.googleusercontent.com *.gravatar.com mozillausercontent.com firefoxusercontent.com profile.stage.mozaws.net profile.accounts.firefox.com developer.mozilla.org mdn.dev interactive-examples.mdn.mozilla.net interactive-examples.mdn.allizom.net wikipedia.org upload.wikimedia.org https://mdn.github.io/shared-assets/ https://mdn.dev/ https://*.google-analytics.com https://*.googletagmanager.com www.gstatic.com; manifest-src 'self'; media-src 'self' archive.org videos.cdn.mozilla.net https://mdn.github.io/shared-assets/; child-src 'self'; worker-src 'self';
x-frame-options: DENY
origin-trial: AxVILwizhbMjxFeHOn1P3R8niO1RJY/smaK4B4d1rLzc1gTaxtXMSaTi+FoigYgCw40uFRDwFcEAeqDR+vVLOW4AAABfeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb25WMiIsImV4cGlyeSI6MTc0MjA3OTYwMH0=
x-cloud-trace-context: b78f492799b8555b887594383d9103a8
date: Sat, 11 Oct 2025 20:38:37 GMT
server: Google Frontend
via: 1.1 google
vary: Accept-Encoding
content-encoding: gzip
x-cache: miss
Math.pow() - JavaScript | MDN
Toggle sidebar
>
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
Math.pow()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
Math.pow()
は静的メソッドで、基数をべき乗した値を返します。
試してみましょう
console.log(Math.pow(7, 3));
// 予想される結果: 343
console.log(Math.pow(4, 0.5));
// 予想される結果: 2
console.log(Math.pow(7, -2));
// 予想される結果: 0.02040816326530612
// (1/49)
console.log(Math.pow(-7, 0.5));
// 予想される結果: NaN
構文
js
Math.pow(base, exponent)
引数
返値
base
を表す数値を exponent
乗した値。以下のいずれかの場合は、 NaN
を返します。
exponent
がNaN
である。base
がNaN
で、exponent
が0
以外である。base
が ±1 で、exponent
が ±Infinity
である。base < 0
で、exponent
が整数ではない。
解説
Math.pow()
は **
演算子と同等ですが、 Math.pow()
は数値のみを受け入れるという点が異なります。
Math.pow(NaN, 0)
(および同等の NaN ** 0
)は、 NaN
が数学演算で伝播しない唯一のケースです。これは、オペランドが NaN
であるにもかかわらず 1
を返します。さらに、 base
が 1 で exponent
が無限大(±Infinity または NaN
)である場合の動作は、結果が 1 となることを規定している IEEE 754 とは異なり、 JavaScript では元の動作との後方互換性を維持するために NaN
を返します。
pow()
は Math
の静的メソッドなので、常に Math.pow()
として使用し、自分で Math
オブジェクトを生成してそのメソッドとして使用しないでください。 (Math
にはコンストラクターがありません)。
例
>Math.pow() の使用
js
// 基本的な例
Math.pow(7, 2); // 49
Math.pow(7, 3); // 343
Math.pow(2, 10); // 1024
// 小数のべき乗
Math.pow(4, 0.5); // 2 (4 の平方根)
Math.pow(8, 1 / 3); // 2 (8 の立方根)
Math.pow(2, 0.5); // 1.4142135623730951 (2 の平方根)
Math.pow(2, 1 / 3); // 1.2599210498948732 (2 の立方根)
// 負の数のべき乗
Math.pow(7, -2); // 0.02040816326530612 (1/49)
Math.pow(8, -1 / 3); // 0.5
// 負の数の底
Math.pow(-7, 2); // 49 (2 乗は正の数)
Math.pow(-7, 3); // -343 (3 乗は負の数)
Math.pow(-7, 0.5); // NaN (負の数には実数の平方根がない)
// Due to "even" and "odd" roots laying close to each other,
// and limits in the floating number precision,
// negative bases with fractional exponents always return NaN,
// even when the mathematical result is real
Math.pow(-7, 1 / 3); // NaN
// Zero and infinity
Math.pow(0, 0); // 1 (任意の数 ** ±0 is 1)
Math.pow(Infinity, 0.1); // Infinity (正の指数)
Math.pow(Infinity, -1); // 0 (負の指数)
Math.pow(-Infinity, 1); // -Infinity (正の奇数の整数の指数)
Math.pow(-Infinity, 1.5); // Infinity (正の指数)
Math.pow(-Infinity, -1); // -0 (負の奇数の整数の指数)
Math.pow(-Infinity, -1.5); // 0 (負の指数)
Math.pow(0, 1); // 0 (正の指数)
Math.pow(0, -1); // Infinity (負の指数)
Math.pow(-0, 1); // -0 (正の奇数の整数の指数)
Math.pow(-0, 1.5); // 0 (正の指数)
Math.pow(-0, -1); // -Infinity (負の奇数の整数の指数)
Math.pow(-0, -1.5); // Infinity (負の指数)
Math.pow(0.9, Infinity); // 0
Math.pow(1, Infinity); // NaN
Math.pow(1.1, Infinity); // Infinity
Math.pow(0.9, -Infinity); // Infinity
Math.pow(1, -Infinity); // NaN
Math.pow(1.1, -Infinity); // 0
// NaN: only Math.pow(NaN, 0) does not result in NaN
Math.pow(NaN, 0); // 1
Math.pow(NaN, 1); // NaN
Math.pow(1, NaN); // NaN
仕様書
Specification |
---|
ECMAScript® 2026 Language Specification> # sec-math.pow> |
ブラウザーの互換性
Loading…