com.sun.squawk.util
Class MathUtils
java.lang.Object
com.sun.squawk.util.MathUtils
public class MathUtils
- extends Object
The class MathUtils
contains some of the Java SE Math routines that are not present in the CLDC 1.1 version of Math
:
asin(double)
, acos(double)
, atan(double)
& atan2(double, double)
.
The methods in this class are directly substitutable for the corresponding methods in Java SE java.lang.Math.
- See Also:
- java.lang.Math in Java SE,
CLDC 1.1's java.lang.Math
Method Summary |
static double |
acos(double a)
Returns the arc cosine of an angle, in the range of 0 through pi. |
static double |
asin(double a)
Returns the arc sine of an angle, in the range of -pi/2 through pi/2. |
static double |
atan(double a)
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2. |
static double |
atan2(double y,
double x)
Converts rectangular coordinates (x, y) to polar (r, theta). |
acos
public static double acos(double a)
- Returns the arc cosine of an angle, in the range of 0 through pi.
Special cases:
- If the argument is NaN or its absolute value is greater than 1, then the result is NaN.
- Parameters:
a
- the value whose arc cosine is to be returned.
- Returns:
- the arc cosine of the argument.
asin
public static double asin(double a)
- Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
Special cases:
- If the argument is NaN or its absolute value is greater than 1, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- Parameters:
a
- the value whose arc sine is to be returned.
- Returns:
- the arc sine of the argument.
atan
public static double atan(double a)
- Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
Special cases:
- If the argument is NaN, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- Parameters:
a
- the value whose arc tangent is to be returned.
- Returns:
- the arc tangent of the argument.
atan2
public static double atan2(double y,
double x)
- Converts rectangular coordinates (x, y) to polar (r, theta).
This method computes the phase theta by computing an arc tangent
of y/x in the range of -pi to pi. Special cases:
- If either argument is NaN, then the result is NaN.
- If the first argument is positive zero and the second argument is positive,
or the first argument is positive and finite and the second argument is positive infinity,
then the result is positive zero.
- If the first argument is negative zero and the second argument is positive,
or the first argument is negative and finite and the second argument is positive infinity,
then the result is negative zero.
- If the first argument is positive zero and the second argument is negative,
or the first argument is positive and finite and the second argument is negative infinity,
then the result is the double value closest to pi.
- If the first argument is negative zero and the second argument is negative,
or the first argument is negative and finite and the second argument is negative infinity,
then the result is the double value closest to -pi.
- If the first argument is positive and the second argument is positive zero or negative zero,
or the first argument is positive infinity and the second argument is finite,
then the result is the double value closest to pi/2.
- If the first argument is negative and the second argument is positive zero or negative zero,
or the first argument is negative infinity and the second argument is finite,
then the result is the double value closest to -pi/2.
- If both arguments are positive infinity, then the result is the double value closest to pi/4.
- If the first argument is positive infinity and the second argument is negative infinity,
then the result is the double value closest to 3*pi/4.
- If the first argument is negative infinity and the second argument is positive infinity,
then the result is the double value closest to -pi/4.
- If both arguments are negative infinity, then the result is the double value closest to -3*pi/4.
- Parameters:
y
- the ordinate coordinatex
- the abscissa coordinate
- Returns:
- the theta component of the point (r, theta) in polar coordinates
that corresponds to the point (x, y) in Cartesian coordinates.
Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.