Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.lang
Class Math

    java.lang.Object
      java.lang.Math

    public final class Math

extends Object

Mathematical functions.

Author:
  Brian Bagnall

Field Summary
`static double` | `E`
`static double` | `NaN`
`static double` | `PI`

Method Summary
`static double` | `abs(double a)` Returns the absolute value of a double value.
`static int` | `abs(int a)` Returns the absolute value of an integer value.
`static double` | `acos(double a)` Arc cosine function.
`static double` | `asin(double a)` Arc sine function.
`static double` | `atan(double x)` Arc tangent function.
`static double` | `atan2(double y, double x)` Arc tangent function valid to the four quadrants y and x can have any value without sigificant precision loss atan2(0,0) returns 0.
`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 using a Chebyshev-Pade approximation.
`static double` | `exp(double a)` 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 int` | `max(int a, int b)` Returns the greater of two integer values.
`static double` | `min(double a, double b)` Returns the lesser of two double values.
`static int` | `min(int a, int b)` Returns the lesser of two integer values.
`static double` | `pow(double a, double b)` Power function.
`static double` | `random()` Random number generator.
`static int` | `round(float a)` Returns the closest int to the argument.
`static double` | `sin(double x)` Sine function using a Chebyshev-Pade approximation.
`static double` | `sqrt(double x)` Square root - thanks to Paulo Costa for donating the code.
`static double` | `tan(double a)` 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
`equals, getClass, hashCode, notify, notifyAll, toString, 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

### NaN

    public static final double NaN

See Also:
  Constant Field Values

Method Detail

### 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.

### 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.

### round

    public static int round(float a)

  Returns the closest int to the argument.

### min

    public static int min(int a,
                          int b)

  Returns the lesser of two integer 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 double max(double a,
                             double b)

  Returns the greater of two double values.

### random

    public static double random()

  Random number generator. Returns a double greater than 0.0 and less than 1.0

### exp

    public static double exp(double a)

  Exponential function. Returns E^x (where E is the base of natural logarithms). Thanks to David Edwards of England for conceiving the code and Martin E. Nielsen for modifying it to handle large arguments. = sum a^n/n!, i.e. 1 + x + x^2/2! + x^3/3!

  Seems to work better for +ve numbers so force argument to be +ve.

### log

    public static double log(double x)

  Natural log function. Returns log(a) to base E Replaced with an algorithm that does not use exponents and so works with large arguments.

  See Also:
    here

### pow

    public static double pow(double a,
                             double b)

  Power function. This is a slow but accurate method. Thanks to David Edwards of England for conceiving the code.

### 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 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.

### sin

    public static double sin(double x)

  Sine function using a Chebyshev-Pade approximation. Thanks to Paulo Costa for donating the code.

### cos

    public static double cos(double x)

  Cosine function using a Chebyshev-Pade approximation. Thanks to Paulo Costa for donating the code.

### sqrt

    public static double sqrt(double x)

  Square root - thanks to Paulo Costa for donating the code.

### tan

    public static double tan(double a)

  Tangent function.

### atan

    public static double atan(double x)

  Arc tangent function. Thanks to Paulo Costa for donating the code.

### atan2

    public static double atan2(double y,
                               double x)

  Arc tangent function valid to the four quadrants y and x can have any value without sigificant precision loss atan2(0,0) returns 0. Thanks to Paulo Costa for donating the code.

### acos

    public static double acos(double a)

  Arc cosine function.

### asin

    public static double asin(double a)

  Arc sine function.

### toDegrees

    public static double toDegrees(double angrad)

  Converts radians to degrees.

### toRadians

    public static double toRadians(double angdeg)

  Converts degrees to radians.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD