Page 191 - Introduction to Programming with Java: A Problem Solving Approach
P. 191

                5.3 Math Class 157
 public static double abs(double num)
Returns the absolute value of a double num. public static int abs(int num)
Returns the absolute value of an int num. public static double ceil(double num)
Returns the smallest whole number greater than or equal to num. ceil stands for “ceiling.” public static double exp(double power)
Returns E (base of natural logarithms) raised to the specified power. public static double floor(double num)
Returns the largest whole number that is less than or equal to num. public static double log(double num)
Returns the natural logarithm (base E) of num. public static double log10(double num)
Returns the base 10 logarithm of num.
public static double max(double x, double y)
Returns the more positive of the two double values, x and y. Apago PDF Enhancer
public static int max(int x, int y)
Returns the more positive of the two int values, x and y. public static double min(double x, double y)
Returns the less positive of the two double values, x and y. public static int min(int x, int y)
Returns the less positive of the two int values, x and y.
public static double pow(double num, double power)
Returns num raised to the specified power. public static double random()
Returns a uniformly distributed value between 0.0 and 1.0, but not including 1.0.
public static long round(double num)
Returns the whole number that is closest to num.
public static double sqrt(double num)
Returns the square root of num.
Figure 5.2 API headings and brief descriptions of some of the methods in the java.lang.Math class












































































   189   190   191   192   193