サイト内検索

Math メソッド一覧

スポンサー

ホーム > Math > sin

sin

サインを返します.

シンタックス

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

解説

sinメソッドはxのサインを-1から1までの範囲で返します.

サンプルコード

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

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

実行例

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

0
1
1.2246467991473532e-16
-1
-2.4492935982947064e-16 

関連項目

スポンサード リンク

inserted by FC2 system