|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j4me.util.MathFunc
public final class MathFunc
Implements the methods which are in the standard J2SE's Math
class,
but are not in in J2ME's.
The following methods are still missing from the implementation:
public static double exp (double a)
public static double log (double a)
public static double pow (double a, double b)
public static double random ()
public static double rint()
Math
Constructor Summary | |
---|---|
MathFunc()
|
Method Summary | |
---|---|
static double |
acos(double a)
Returns the arc cosine of an angle, in the range of 0.0 through Math.PI . |
static double |
asin(double a)
Returns the arc sine of an angle, in the range of -Math.PI/2 through
Math.PI/2 . |
static double |
atan(double a)
Returns the arc tangent of an angle, in the range of -Math.PI/2
through Math.PI/2 . |
static double |
atan2(double y,
double x)
Converts rectangular coordinates (x, y) to polar (r, theta). |
static long |
round(double a)
Returns the closest long to the argument. |
static int |
round(float a)
Returns the closest int to the argument. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MathFunc()
Method Detail |
---|
public static double acos(double a)
Math.PI
.
Special case:
NaN
or its absolute value is greater than 1,
then the result is NaN
.
a
- - the value whose arc cosine is to be returned.
public static double asin(double a)
-Math.PI/2
through
Math.PI/2
. Special cases:
NaN
or its absolute value is greater than 1,
then the result is NaN
.
a
- - the value whose arc sine is to be returned.
public static double atan(double a)
-Math.PI/2
through Math.PI/2
. Special cases:
NaN
, then the result is NaN
.
A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic.
a
- - the value whose arc tangent is to be returned.
public static double atan2(double y, double x)
NaN
, then the result is NaN
.
double
value
closest to pi.
double
value
closest to -pi.
double
value
closest to pi/2.
double
value
closest to -pi/2.
A result must be within 2 ulps of the correctly rounded result. Results must be semi-monotonic.
y
- - the ordinate coordinatex
- - the abscissa coordinate
public static int round(float a)
int
to the argument. The
result is rounded to an integer by adding 1/2, taking the
floor of the result, and casting the result to type int
.
In other words, the result is equal to the value of the expression:
(int)Math.floor(a + 0.5f)
Special cases:
Integer.MIN_VALUE
, the result is
equal to the value of Integer.MIN_VALUE
.
Integer.MAX_VALUE
, the result is
equal to the value of Integer.MAX_VALUE
.
a
- - a floating-point value to be rounded to an integer.
int
value.public static long round(double a)
long
to the argument. The result
is rounded to an integer by adding 1/2, taking the floor of the
result, and casting the result to type long
. In other
words, the result is equal to the value of the expression:
(long)Math.floor(a + 0.5d)
Special cases:
Long.MIN_VALUE
, the result is
equal to the value of Long.MIN_VALUE
.
Long.MAX_VALUE
, the result is
equal to the value of Long.MAX_VALUE
.
a
- - a floating-point value to be rounded to a long
.
long
value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |