--- 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 ---
Math.atan() 関数は、引数として与えた数値のアークタンジェントをラジアン単位で返します。
Math.atan(x)
x与えられた数値のアークタンジェント (ラジアン単位) です。
Math.atan() メソッドは から までのラジアンの数値を返します。
atan() は Math の静的メソッドであるため、生成した Math オブジェクトのメソッドとしてではなく、常に Math.atan() として使用するようにしてください (Math はコンストラクターではありません)。
Math.atan(1); // 0.7853981633974483
Math.atan(0); // 0
Math.atan(-0); // -0
Math.atan(Infinity); // 1.5707963267948966
Math.atan(-Infinity); // -1.5707963267948966
// The angle that the line [(0,0);(x,y)] forms with the x-axis in a Cartesian coordinate system
Math.atan(y / x);
様式上の理由から ±Infinity の使用を避けたいと思うことがあるかもしれません。その場合、 {{jsxref("Math.atan2()")}} を第二引数を 0 としてを使うとよりよいかもしれません。
| 仕様書 |
|---|
| {{SpecName('ESDraft', '#sec-math.atan', 'Math.atan')}} |
{{Compat("javascript.builtins.Math.atan")}}