ホームページ  >  記事  >  Java  >  Java の StrictMath クラスの目的は何ですか?

Java の StrictMath クラスの目的は何ですか?

PHPz
PHPz転載
2023-09-12 21:21:021319ブラウズ

Java の StrictMath クラスの目的は何ですか?

java.lang.StrictMath は、Object クラスのサブクラスである最終クラスです。 StrictMath クラスには、基本的な指数、対数、平方根、三角関数などの基本的な数値演算を実行するためのメソッドが含まれています。 StrictMath クラスのすべてのメソッドは 静的メソッドであるため、StrictMath クラスのインスタンスを作成する必要はありません。 StrictMath クラスの重要なメソッドは、abs()、acos()、asin()、atan()、ceil()、floor()、log()、max()、min()、pow()、random( )、round() etc構文

public final class StrictMath extends Object

public class StrictMathTest {
   public static void main(String args[]) {
      System.out.println("Absolute Value: " + StrictMath.abs(-100.50));
      System.out.println("Ceil Value : " + StrictMath.ceil(100.55));
      System.out.println("Floor Value : " + StrictMath.floor(100.55));
      System.out.println("Maximum Value : " + StrictMath.max(100,200));
      System.out.println("Minimum Value : " + StrictMath.min(100,200));
      System.out.println("Random Value : " + StrictMath.random());
      System.out.println("Round Value: " + StrictMath.round(100.75));
      System.out.println("Square Root Value : " + StrictMath.sqrt(2));
      System.out.println("PI Value: " + StrictMath.PI);
      System.out.println("Log Value: " + StrictMath.log(10.55));
   }
}

出力

Absolute Value: 100.5
Ceil Value : 101.0
Floor Value : 100.0
Maximum Value : 200
Minimum Value : 100
Random Value : 0.22227639516105102
Round Value: 101
Square Root Value : 1.4142135623730951
PI Value: 3.141592653589793
Log Value: 2.3561258599220753

以上がJava の StrictMath クラスの目的は何ですか?の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事はtutorialspoint.comで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。