| java.lang.Object com.sun.perseus.platform.MathSupport
MathSupport | final public class MathSupport (Code) | | This class is used to provide URL resolution.
version: $Id: MathSupport.java,v 1.5 2006/04/21 06:34:50 st125089 Exp $ |
Field Summary | |
final public static float | PI The double value that is closer than any other to
pi, the ratio of the circumference of a circle to its
diameter. |
Method Summary | |
public static int | abs(int a) Returns the absolute value of an int value.
If the argument is not negative, the argument is returned.
If the argument is negative, the negation of the argument is returned. | 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.
Special cases:
- If the argument is positive zero or negative zero, the
result is positive zero.
| public static float | atan(float a) Returns the arc tangent of an angle, in the range of -pi/2
through pi/2. | public static float | atan2(float y, float 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. | public static float | cos(float a) Returns the trigonometric cosine of an angle. | public static int | round(float a) Returns the closest int to the argument. | public static float | sin(float a) Returns the trigonometric sine of an angle. | public static float | sqrt(float a) Returns the correctly rounded positive square root of a
float value.
Special cases:
- If the argument is NaN or less than zero, then the result
is NaN.
| public static float | tan(float a) Returns the trigonometric tangent of an angle. | public static float | toDegrees(float angrad) Converts an angle measured in radians to an approximately
equivalent angle measured in degrees. | public static float | toRadians(float angdeg) Converts an angle measured in degrees to an approximately
equivalent angle measured in radians. |
PI | final public static float PI(Code) | | The double value that is closer than any other to
pi, the ratio of the circumference of a circle to its
diameter.
|
abs | public static int abs(int a)(Code) | | Returns the absolute value of an int 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 if the argument is equal to the value of
Integer.MIN_VALUE , the most negative representable
int value, the result is that same value, which is
negative.
Parameters: a - the argument whose absolute value is to be determined the absolute value of the argument. See Also: java.lang.Integer.MIN_VALUE |
abs | public static float abs(float a)(Code) | | 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.
Special cases:
- If the argument is positive zero or negative zero, the
result is positive zero.
- If the argument is infinite, the result is positive infinity.
- If the argument is NaN, the result is NaN.
In other words, the result is the same as the value of the expression:
Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))
Parameters: a - the argument whose absolute value is to be determined the absolute value of the argument. |
atan | public static float atan(float a)(Code) | | 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.
A result must be within 1 ulp of the correctly rounded result. Results
must be semi-monotonic.
Parameters: a - the value whose arc tangent is to be returned. the arc tangent of the argument. |
atan2 | public static float atan2(float y, float x)(Code) | | 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
float 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
float 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
float 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
float value closest to -pi/2.
- If both arguments are positive infinity, then the result is the
float value closest to pi/4.
- If the first argument is positive infinity and the second argument
is negative infinity, then the result is the
float
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
float value
closest to -pi/4.
- If both arguments are negative infinity, then the result is the
float value closest to -3*pi/4.
A result must be within 2 ulps of the correctly rounded result. Results
must be semi-monotonic.
Parameters: y - the ordinate coordinate Parameters: x - the abscissa coordinate the theta component of the point(r, theta)in polar coordinates that corresponds to the point(x, y) in Cartesian coordinates. |
cos | public static float cos(float a)(Code) | | Returns the trigonometric cosine of an angle. Special cases:
- If the argument is NaN or an infinity, then the
result is NaN.
A result must be within 1 ulp of the correctly rounded result. Results
must be semi-monotonic.
Parameters: a - an angle, in radians. the cosine of the argument. |
round | public static int round(float a)(Code) | | Returns the closest 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:
- If the argument is NaN, the result is 0.
- If the argument is negative infinity or any value less than or
equal to the value of
Integer.MIN_VALUE , the result is
equal to the value of Integer.MIN_VALUE .
- If the argument is positive infinity or any value greater than or
equal to the value of
Integer.MAX_VALUE , the result is
equal to the value of Integer.MAX_VALUE .
Parameters: a - a floating-point value to be rounded to an integer. the value of the argument rounded to the nearestint value. See Also: java.lang.Integer.MAX_VALUE See Also: java.lang.Integer.MIN_VALUE |
sin | public static float sin(float a)(Code) | | Returns the trigonometric sine of an angle. Special cases:
- If the argument is NaN or an infinity, then the
result is NaN.
- If the argument is zero, then the result is a zero with the
same sign as the argument.
A result must be within 1 ulp of the correctly rounded result. Results
must be semi-monotonic.
Parameters: a - an angle, in radians. the sine of the argument. |
sqrt | public static float sqrt(float a)(Code) | | Returns the correctly rounded positive square root of a
float value.
Special cases:
- If the argument is NaN or less than zero, then the result
is NaN.
- If the argument is positive infinity, then the result is positive
infinity.
- If the argument is positive zero or negative zero, then the
result is the same as the argument.
Otherwise, the result is the float value closest to
the true mathematical square root of the argument value.
Parameters: a - a value. the positive square root of a .If the argument is NaN or less than zero, the result is NaN. |
tan | public static float tan(float a)(Code) | | Returns the trigonometric tangent of an angle. Special cases:
- If the argument is NaN or an infinity, then the result
is NaN.
- If the argument is zero, then the result is a zero with the
same sign as the argument.
A result must be within 1 ulp of the correctly rounded result. Results
must be semi-monotonic.
Parameters: a - an angle, in radians. the tangent of the argument. |
toDegrees | public static float toDegrees(float angrad)(Code) | | Converts an angle measured in radians to an approximately
equivalent angle measured in degrees. The conversion from
radians to degrees is generally inexact; users should
not expect cos(toRadians(90.0)) to exactly
equal 0.0 .
Parameters: angrad - an angle, in radians the measurement of the angle angrad in degrees. since: 1.2 |
toRadians | public static float toRadians(float angdeg)(Code) | | Converts an angle measured in degrees to an approximately
equivalent angle measured in radians. The conversion from
degrees to radians is generally inexact.
Parameters: angdeg - an angle, in degrees the measurement of the angle angdeg in radians. since: 1.2 |
|
|