サイト内検索

Math メソッド一覧

スポンサー

ホーム > Math > tan

tan

タンジェントを返します.

シンタックス

Math.tan(x)
  • x - 角度 (ラジアン単位)

解説

tanメソッドはxのタンジェントを-1から1までの範囲で返します.

サンプルコード

以下にtanメソッドを使用したサンプルコードを示します.

<html>
  <head>
    <title>tanメソッドのサンプルコード</title>
  </head>
  <body>
    <script type="text/javascript" language="javascript">
      document.write(Math.tan(0) + "<br />");
      document.write(Math.tan(Math.PI / 2) + "<br />");
      document.write(Math.tan(Math.PI) + "<br />");
      document.write(Math.tan(3 / 2 * Math.PI) + "<br />");
      document.write(Math.tan(2 * Math.PI));
    </script>
  </body>
</html>

実行例

サンプルコードの実行結果は以下のようになります.

0
16331239353195370
-1.2246467991473532e-16
5443746451065123
-2.4492935982947064e-16 

関連項目

スポンサード リンク

inserted by FC2 system