--- title: Math.atanh() slug: Web/JavaScript/Reference/Global_Objects/Math/atanh tags: - JavaScript - Math - Method - Reference translation_of: Web/JavaScript/Reference/Global_Objects/Math/atanh ---
{{JSRef}}

Math.atanh() 関数は、数値の双曲線逆正接 (ハイパーボリックアークタンジェント) を返します。

x(-1,1),Math.atanh(x)=arctanh(x)= the unique ysuch thattanh(y)=x\forall x \in \left( -1, 1 \right), \mathtt{\operatorname{Math.atanh}(x)} = \operatorname{arctanh}(x) = \text{ the unique } \; y \; \text{such that} \; \tanh(y) = x

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

構文

Math.atanh(x)

引数

x
数値。

返値

与えられた数値の双曲線逆正接 (ハイパーボリックアークタンジェント) です。

解説

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

Math.atanh() の使用

Math.atanh(-2);  // NaN
Math.atanh(-1);  // -Infinity
Math.atanh(0);   // 0
Math.atanh(0.5); // 0.5493061443340548
Math.atanh(1);   // Infinity
Math.atanh(2);   // NaN

1よりも大きな値もしくは -1 よりも小さな値に対しては、 {{jsxref("NaN")}} が返されます。

ポリフィル

|x|<1\left|x\right| < 1に対して、 artanh(x)=12ln(1+x1-x)\operatorname {artanh} (x) = \frac{1}{2}\ln \left( \frac{1 + x}{1 - x} \right) になり、次の関数でエミュレートできます。

Math.atanh = Math.atanh || function(x) {
  return Math.log((1+x)/(1-x)) / 2;
};

仕様書

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

ブラウザーの互換性

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

関連情報