Java in a Nutshell

Previous Chapter 25
The java.lang Package
Next
 

25.37 java.lang.Math (JDK 1.0)

This class defines constants for the mathematical values e and pi, and defines static methods for floating-point trigonometry, exponentiation, and other operations. It is the equivalent of the C <math.h> functions. It also contains methods for computing minimum and maximum values and for generating pseudo-random numbers.


public final class Math extends Object {

    // No Constructor

    // Constants

            public static final double E;

            public static final double PI;

    // Class Methods

            public static native double IEEEremainder(double f1, double f2);

            public static int abs(int a);

            public static long abs(long a);

            public static float abs(float a);

            public static double abs(double a);

            public static native double acos(double a);

            public static native double asin(double a);

            public static native double atan(double a);

            public static native double atan2(double a, double b);

            public static native double ceil(double a);

            public static native double cos(double a);

            public static native double exp(double a);

            public static native double floor(double a);

            public static native double log(double a);

            public static int max(int a, int b);

            public static long max(long a, long b);

            public static float max(float a, float b);

            public static double max(double a, double b);

            public static int min(int a, int b);

            public static long min(long a, long b);

            public static float min(float a, float b);

            public static double min(double a, double b);

            public static native double pow(double a, double b);

            public static synchronized double random();

            public static native double rint(double a);

            public static int round(float a);

            public static long round(double a);

            public static native double sin(double a);

            public static native double sqrt(double a);

            public static native double tan(double a);

}


Previous Home Next
java.lang.Long (JDK 1.0) Book Index java.lang.NegativeArraySizeException (JDK 1.0)

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java