java.lang
Class Math

java.lang.Object
  extended by java.lang.Math

public final class Math
extends Object

Mathematical functions.

Author:
Brian Bagnall

Field Summary
static double E
           
static double PI
           
 
Method Summary
static double abs(double a)
          Returns the absolute value of a double value.
static float abs(float a)
          Returns the absolute value of a float value.
static int abs(int a)
          Returns the absolute value of an integer value.
static long abs(long a)
          Returns the absolute value of a long value.
static double acos(double a)
          Inverse cosine function.
static double asin(double a)
          Inverse sine function.
static double atan(double x)
          The inverse tangent function.
static double atan2(double y, double x)
          The inverse tangent function.
static double ceil(double a)
          Returns the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer.
static double cos(double x)
          Cosine function.
static double exp(double x)
          Exponential function.
static double floor(double a)
          Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer.
static double log(double x)
          Natural log function.
static double max(double a, double b)
          Returns the greater of two double values.
static float max(float a, float b)
          Returns the greater of two float values.
static int max(int a, int b)
          Returns the greater of two integer values.
static long max(long a, long b)
          Returns the greater of two long values.
static double min(double a, double b)
          Returns the lesser of two double values.
static float min(float a, float b)
          Returns the lesser of two float values.
static int min(int a, int b)
          Returns the lesser of two integer values.
static long min(long a, long b)
          Returns the lesser of two long values.
static double pow(double a, double b)
          Power function.
static double random()
          Random number generator.
static double rint(double a)
          Returns the closest mathematical integer to the argument.
static long round(double a)
          Returns the closest long to the argument.
static int round(float a)
          Returns the closest int to the argument.
static double signum(double d)
          Returns -1, 1 or 0 depending on the sign of f.
static float signum(float f)
          Returns -1, 1 or 0 depending on the sign of f.
static double sin(double x)
          Sine function.
static double sqrt(double x)
          Computes square-root of x.
static double tan(double x)
          Tangent function.
static double toDegrees(double angrad)
          Converts radians to degrees.
static double toRadians(double angdeg)
          Converts degrees to radians.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

E

public static final double E
See Also:
Constant Field Values

PI

public static final double PI
See Also:
Constant Field Values
Method Detail

abs

public static double abs(double a)
Returns the absolute value of a double value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.


abs

public static float abs(float a)
Returns the absolute value of a float value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.


abs

public static long abs(long a)
Returns the absolute value of a long value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Note that the return value of abs(Long.MIN_VALUE) is Long.MIN_VALUE.


abs

public static int abs(int a)
Returns the absolute value of an integer value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Note that the return value of abs(Integer.MIN_VALUE) is Integer.MIN_VALUE.


signum

public static float signum(float f)
Returns -1, 1 or 0 depending on the sign of f.


signum

public static double signum(double d)
Returns -1, 1 or 0 depending on the sign of f.


min

public static int min(int a,
                      int b)
Returns the lesser of two integer values.


min

public static long min(long a,
                       long b)
Returns the lesser of two long values.


min

public static float min(float a,
                        float b)
Returns the lesser of two float values.


min

public static double min(double a,
                         double b)
Returns the lesser of two double values.


max

public static int max(int a,
                      int b)
Returns the greater of two integer values.


max

public static long max(long a,
                       long b)
Returns the greater of two long values.


max

public static float max(float a,
                        float b)
Returns the greater of two float values.


max

public static double max(double a,
                         double b)
Returns the greater of two double values.


floor

public static double floor(double a)
Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer.


ceil

public static double ceil(double a)
Returns the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer.


round

public static int round(float a)
Returns the closest int to the argument.


round

public static long round(double a)
Returns the closest long to the argument.


rint

public static double rint(double a)
Returns the closest mathematical integer to the argument.


random

public static double random()
Random number generator. Returns a double greater than or equal to zero and less than one.


sqrt

public static double sqrt(double x)
Computes square-root of x.


exp

public static double exp(double x)
Exponential function. Returns E^x (where E is the base of natural logarithms).


log

public static double log(double x)
Natural log function. Returns log(x) to base E.


pow

public static double pow(double a,
                         double b)
Power function. This is a slow but accurate method.


toDegrees

public static double toDegrees(double angrad)
Converts radians to degrees.


toRadians

public static double toRadians(double angdeg)
Converts degrees to radians.


sin

public static double sin(double x)
Sine function.


cos

public static double cos(double x)
Cosine function.


tan

public static double tan(double x)
Tangent function.


atan

public static double atan(double x)
The inverse tangent function.


atan2

public static double atan2(double y,
                           double x)
The inverse tangent function. This function converts the coordinates x and y to an angle in the range -Pi to Pi. The angle is relative to the positive x axis, counter clockwise.


asin

public static double asin(double a)
Inverse sine function.


acos

public static double acos(double a)
Inverse cosine function.