--- title: Math.atan() slug: Web/JavaScript/Reference/Global_Objects/Math/atan tags: - JavaScript - Math - Method - Reference translation_of: Web/JavaScript/Reference/Global_Objects/Math/atan --- <div>{{JSRef}}</div> <p><strong><code>Math.atan()</code></strong> 関数は、引数として与えた数値のアークタンジェントをラジアン単位で返します。</p> <p><math display="block"><semantics><mrow><mstyle mathvariant="monospace"><mrow><mo lspace="0em" rspace="thinmathspace">Math.atan</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><mo lspace="0em" rspace="0em">arctan</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mtext> the unique </mtext><mspace width="thickmathspace"></mspace><mi>y</mi><mo>∊</mo><mrow><mo>[</mo><mrow><mo>-</mo><mfrac><mi>π</mi><mn>2</mn></mfrac><mo>;</mo><mfrac><mi>π</mi><mn>2</mn></mfrac></mrow><mo>]</mo></mrow><mspace width="thinmathspace"></mspace><mtext>such that</mtext><mspace width="thickmathspace"></mspace><mo lspace="0em" rspace="0em">tan</mo><mo stretchy="false">(</mo><mi>y</mi><mo stretchy="false">)</mo><mo>=</mo><mi>x</mi></mrow><annotation encoding="TeX">\mathtt{\operatorname{Math.atan}(x)} = \arctan(x) = \text{ the unique } \; y \in \left[-\frac{\pi}{2}; \frac{\pi}{2}\right] \, \text{such that} \; \tan(y) = x</annotation></semantics></math></p> <div>{{EmbedInteractiveExample("pages/js/math-atan.html")}}</div> <div class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</div> <h2 id="Syntax" name="Syntax">構文</h2> <pre class="syntaxbox notranslate"><code>Math.atan(<var>x</var>)</code></pre> <h3 id="Parameters" name="Parameters">引数</h3> <dl> <dt><code><var>x</var></code></dt> <dd>数値です。</dd> </dl> <h3 id="Return_value" name="Return_value">返値</h3> <p>与えられた数値のアークタンジェント (ラジアン単位) です。</p> <h2 id="Description" name="Description">解説</h2> <p><code>Math.atan()</code> メソッドは <math><semantics><mrow><mo>-</mo><mfrac><mi>π</mi><mn>2</mn></mfrac></mrow><annotation encoding="TeX">-\frac{\pi}{2}</annotation></semantics></math> から <math><semantics><mfrac><mi>π</mi><mn>2</mn></mfrac><annotation encoding="TeX">\frac{\pi}{2}</annotation></semantics></math> までのラジアンの数値を返します。</p> <p><code>atan()</code> は <code>Math</code> の静的メソッドであるため、生成した <code>Math</code> オブジェクトのメソッドとしてではなく、常に <code>Math.atan()</code> として使用するようにしてください (<code>Math</code> はコンストラクターではありません)。</p> <h2 id="Examples" name="Examples">例</h2> <h3 id="Using_Math.atan" name="Using_Math.atan">Math.atan() の使用</h3> <pre class="brush: js notranslate">Math.atan(1); // 0.7853981633974483 Math.atan(0); // 0 Math.atan(-0); // -0 Math.atan(Infinity); <span class="objectBox objectBox-number"> // 1.5707963267948966 Math.atan(-Infinity); // -1.5707963267948966 </span>// The angle that the line [(0,0);(x,y)] forms with the x-axis in a Cartesian coordinate system Math.atan(y / x); </pre> <p>様式上の理由から <strong>±</strong><code>Infinity</code> の使用を避けたいと思うことがあるかもしれません。その場合、 {{jsxref("Math.atan2()")}} を第二引数を <code>0</code> としてを使うとよりよいかもしれません。</p> <h2 id="Specifications" name="Specifications">仕様書</h2> <table class="standard-table"> <thead> <tr> <th scope="col">仕様書</th> </tr> </thead> <tbody> <tr> <td>{{SpecName('ESDraft', '#sec-math.atan', 'Math.atan')}}</td> </tr> </tbody> </table> <h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> <p>{{Compat("javascript.builtins.Math.atan")}}</p> <h2 id="See_also" name="See_also">関連情報</h2> <ul> <li>{{jsxref("Math.acos()")}}</li> <li>{{jsxref("Math.asin()")}}</li> <li>{{jsxref("Math.atan2()")}}</li> <li>{{jsxref("Math.cos()")}}</li> <li>{{jsxref("Math.sin()")}}</li> <li>{{jsxref("Math.tan()")}}</li> </ul>