java tan値を取得する

java tan値を取得する

javaで、tan値を取得する手順を記述してます。

環境

  • OS windows11 home
  • java 17.0.2

手順

tan値を取得するには、「Math.tan」で可能です。

Math.tan(数値)

実際に、使用してみます。

public class App {
    public static void main(String[] args) throws Exception {

        System.out.println(Math.tan(Math.PI / 3));  // 1.7320508075688767
        System.out.println(Math.tan(Math.PI / 4));  // 0.9999999999999999

    }
}

取得されていることが確認できます。