Class JdkMath


  • public final class JdkMath
    extends Object
    Wrapper for alternative implementations of Math functions. For example, a call to Math.sin(x) can be replaced by a call to JdkMath.sin(x).

    This class is a "drop-in" replacement for both Math and StrictMath, up to the minimal JDK version required by this library (meaning that, although the library can be used on more recent JVMs, the JdkMath class may be missing the methods that were absent in older JDKs).

    Based on the value, at class initialization, of the system property org.apache.commons.math.jdkmath, this class redirects to a specific implementation:

    When the property is undefined, CM is the default value.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  JdkMath.Impl
      Available implementations of Math functions.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double E
      Constant.
      static double PI
      Constant.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double abs​(double x)  
      static float abs​(float x)  
      static int abs​(int x)  
      static long abs​(long x)  
      static double acos​(double x)  
      static double acosh​(double x)  
      static int addExact​(int x, int y)  
      static long addExact​(long x, long y)  
      static double asin​(double x)  
      static double asinh​(double x)  
      static double atan​(double x)  
      static double atan2​(double y, double x)  
      static double atanh​(double x)  
      static double cbrt​(double x)  
      static double ceil​(double x)  
      static double copySign​(double x, double y)  
      static float copySign​(float x, float y)  
      static double cos​(double x)  
      static double cosh​(double x)  
      static int decrementExact​(int x)  
      static long decrementExact​(long x)  
      static double exp​(double x)  
      static double expm1​(double x)  
      static double floor​(double x)  
      static int floorDiv​(int x, int y)  
      static long floorDiv​(long x, long y)  
      static int floorMod​(int x, int y)  
      static long floorMod​(long x, long y)  
      static int getExponent​(double x)  
      static int getExponent​(float x)  
      static double hypot​(double x, double y)  
      static double IEEEremainder​(double x, double y)  
      static int incrementExact​(int x)  
      static long incrementExact​(long x)  
      static double log​(double x)  
      static double log10​(double x)  
      static double log1p​(double x)  
      static double max​(double x, double y)  
      static float max​(float x, float y)  
      static int max​(int x, int y)  
      static long max​(long x, long y)  
      static double min​(double x, double y)  
      static float min​(float x, float y)  
      static int min​(int x, int y)  
      static long min​(long x, long y)  
      static int multiplyExact​(int x, int y)  
      static long multiplyExact​(long x, long y)  
      static int negateExact​(int x)  
      static long negateExact​(long x)  
      static double nextAfter​(double x, double y)  
      static float nextAfter​(float x, double y)  
      static double nextDown​(double x)  
      static float nextDown​(float x)  
      static double nextUp​(double x)  
      static float nextUp​(float x)  
      static double pow​(double x, double y)  
      static double random()  
      static double rint​(double x)  
      static long round​(double x)  
      static int round​(float x)  
      static double scalb​(double x, int y)  
      static float scalb​(float x, int y)  
      static double signum​(double x)  
      static float signum​(float x)  
      static double sin​(double x)  
      static double sinh​(double x)  
      static double sqrt​(double x)  
      static int subtractExact​(int x, int y)  
      static long subtractExact​(long x, long y)  
      static double tan​(double x)  
      static double tanh​(double x)  
      static double toDegrees​(double x)  
      static int toIntExact​(long x)  
      static double toRadians​(double x)  
      static double ulp​(double x)  
      static float ulp​(float x)