From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../reference/global_objects/math/log10/index.html | 94 ++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 files/ja/web/javascript/reference/global_objects/math/log10/index.html (limited to 'files/ja/web/javascript/reference/global_objects/math/log10/index.html') diff --git a/files/ja/web/javascript/reference/global_objects/math/log10/index.html b/files/ja/web/javascript/reference/global_objects/math/log10/index.html new file mode 100644 index 0000000000..cc9aca7ba5 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/math/log10/index.html @@ -0,0 +1,94 @@ +--- +title: Math.log10() +slug: Web/JavaScript/Reference/Global_Objects/Math/log10 +tags: + - ECMAScript 2015 + - JavaScript + - Math + - Method + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Math/log10 +--- +
{{JSRef}}
+ +

Math.log10() 関数は、数値の 10 を底とした対数を返します。

+ +

x>0,Math.log10(x)=log10(x)=the uniqueysuch that10y=x\forall x > 0, \mathtt{\operatorname{Math.log10}(x)} = \log_10(x) = \text{the unique} \; y \; \text{such that} \; 10^y = x

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

構文

+ +
Math.log10(x)
+ +

引数

+ +
+
x
+
数値です。
+
+ +

返値

+ +

与えられた数値の 10 を底とした対数です。数値が負の数であった場合、 {{jsxref("NaN")}} が返されます。

+ +

解説

+ +

x の値が 0 未満であった場合、返値は常に {{jsxref("NaN")}} です。

+ +

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

+ +

この関数は Math.log(x) / Math.log(10) と同等です。 log10(e) には定数 {{jsxref("Math.LOG10E")}} を使用してください (これは 1 / {{jsxref("Math.LN10")}} です。)

+ +

+ +

Math.log10() の使用

+ +
Math.log10(2);      // 0.3010299956639812
+Math.log10(1);      // 0
+Math.log10(0);      // -Infinity
+Math.log10(-2);     // NaN
+Math.log10(100000); // 5
+
+ +

ポリフィル

+ +

これは以下の関数でエミュレートできます。

+ +
Math.log10 = Math.log10 || function(x) {
+  return Math.log(x) * Math.LOG10E;
+};
+
+ +

仕様書

+ + + + + + + + + + + + +
仕様書
{{SpecName('ESDraft', '#sec-math.log10', 'Math.log10')}}
+ +

ブラウザーの互換性

+ + + +

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

+ +

関連情報

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