Math.LN2

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Math.LN2 は静的データプロパティで、 2 の自然対数、およそ 0.693 を表します。

試してみましょう

function getNatLog2() {
  return Math.LN2;
}

console.log(getNatLog2());
// Expected output: 0.6931471805599453

𝙼𝚊𝚝𝚑.𝙻𝙽𝟸=ln(2)0.693\mathtt{Math.LN2} = \ln(2) \approx 0.693
Math.LN2 のプロパティ属性
書込可能不可
列挙可能不可
設定可能不可

解説

LN2Math オブジェクトの静的プロパティなので、 Math オブジェクトを生成してプロパティとして使用するのではなく、常に Math.LN2 として使用するようにしてください (Math はコンストラクターではありません)。

Math.LN2 の使用

以下の関数は、2 の自然対数を返します。

js
function getNatLog2() {
  return Math.LN2;
}

getNatLog2(); // 0.6931471805599453

仕様書

Specification
ECMAScript® 2025 Language Specification
# sec-math.ln2

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
LN2

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報