What's the difference between java.lang.Math and java.lang.StrictMath?

后端 未结 4 1949
梦毁少年i
梦毁少年i 2020-12-04 14:55

Obviously java.lang.StrictMath contains additional functions (hyperbolics etc.) which java.lang.Math doesn\'t, but is there a difference in the functions which are found in

4条回答
  •  [愿得一人]
    2020-12-04 15:44

    Did you check the source code? Many methods in java.lang.Math are delegated to java.lang.StrictMath.

    Example:

    public static double cos(double a) {
        return StrictMath.cos(a); // default impl. delegates to StrictMath
    }
    

提交回复
热议问题