Workshop 2007 JRE Java Support
Installation
Home
CalcTool
Java Applets
Friends/Family
Gardening
Woodworking
Forums

Methods and Constants in the Math Class

 

Constants

These constants are referred to via the form Math.Constant.  For example, Euler’s constant is
Math.E

static double

E
          The double value that is closer than any other to e, the base of the natural logarithms.

static double

PI
          The double value that is closer than any other to a, the ratio of the circumference of a circle to its diameter.

 

 

 

Methods

All methods are called by using the form Math.method(argument). The following example calls the method a and returns a value to be placed in the variable y.
double y=Math.sin(x);

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 int value.

static long

abs(long a)
          Returns the absolute value of a long value.

static double

acos(double a)
          Returns the arc cosine of an angle, in the range of 0.0 through a.

static double

asin(double a)
          Returns the arc sine of an angle, in the range of a through a.

static double

atan(double a)
          Returns the arc tangent of an angle, in the range of athrough a.

static double

atan2(double y, double x)
          Converts rectangular coordinates (x, y) to polar a.

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 a)
          Returns the trigonometric cosine of an angle.

static double

exp(double a)
          Returns Euler's number e raised to the power of a double value.

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

IEEEremainder(double f1, double f2)
          Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.

static double

log(double a)
          Returns the natural logarithm (base e) of a double value.

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 int values.

static long

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

static double

min(double a, double b)
          Returns the smaller of two double values.

static float

min(float a, float b)
          Returns the smaller of two float values.

static int

min(int a, int b)
          Returns the smaller of two int values.

static long

min(long a, long b)
          Returns the smaller of two long values.

static double

pow(double a, double b)
          Returns of value of the first argument raised to the power of the second argument.

static double

random()
          Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.

static double

rint(double a)
          Returns the double value that is closest in value to the argument and is equal to a mathematical integer.

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

sin(double a)
          Returns the trigonometric sine of an angle.

static double

sqrt(double a)
          Returns the correctly rounded positive square root of a double value.

static double

tan(double a)
          Returns the trigonometric tangent of an angle.

static double

toDegrees(double angrad)
          Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

static double

toRadians(double angdeg)
          Converts an angle measured in degrees to an approximately equivalent angle measured in radians.