|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openmali.FastMathd
public class FastMathd
The FastMath class provides fast and optimized mathematical functions.
| Nested Class Summary | |
|---|---|
static class |
FastMathd.FRExpResultd
Helper class to return result tuple of frexp() |
| Field Summary | |
|---|---|
static double |
DEG_TO_RAD
|
static double |
E
|
static double |
INV_PI
|
static double |
INV_TWO_PI
|
static double |
LOG10_TO_LOG2
|
static double |
LOG10_TO_LOG2d
|
static double |
PI
|
static double |
PI_HALF
|
static double |
RAD_TO_DEG
|
static double |
TWO_PI
|
| Constructor Summary | |
|---|---|
FastMathd()
|
|
| Method Summary | |
|---|---|
static double |
acos(double x)
|
static double |
asin(double x)
|
static double |
atan(double x)
|
static double |
atan2(double y,
double x)
|
static double |
cbrt(double x)
|
static double |
ceil(double x)
|
static double |
cos(double x)
|
static double |
cosh(double x)
|
static boolean |
epsilonEquals(double v1,
double v2,
double epsilon)
|
static double |
floor(double x)
|
static FastMathd.FRExpResultd |
frexp(double value)
An implementation of the C standard library frexp() function. |
static FastMathd.FRExpResultd |
frexp(double value,
FastMathd.FRExpResultd result)
An implementation of the C standard library frexp() function. |
static int |
getPrecision()
|
static java.util.Random |
getRandom()
Gets the Random generator. |
static double |
hypot(double a,
double b)
sqrt(a^2 + b^2) without under/overflow. |
static double |
invSqrt(double x)
|
static double |
log(double x)
|
static double |
log10(double x)
|
static double |
log1p(double x)
|
static double |
log2(double x)
|
static double |
pow(double base,
double exp)
|
static double |
pow2(double base)
|
static double |
pow3(double base)
|
static double |
randomDouble()
Returns the next pseudorandom, uniformly distributed float
value between 0.0 and 1.0 from this random
number generator's sequence. |
static double |
randomDouble(float max)
Generates the next random double (minimum: 0 inclusive). |
static double |
randomDouble(float min,
float max)
Generates the next random double. |
static int |
randomInt()
Generates the next random int (minimum: 0 inclusive, maximum: Integer.MAX_VALUE exclusive). |
static int |
randomInt(int max)
Generates the next random int (minimum: 0 inclusive). |
static int |
randomInt(int min,
int max)
Generates the next random int. |
static long |
randomLong()
Generates the next random long (minimum: 0 inclusive, maximum: Long.MAX_VALUE exclusive). |
static long |
randomLong(long max)
Generates the next random long (minimum: 0 inclusive). |
static long |
randomLong(long min,
long max)
Generates the next random long. |
static void |
setPrecision(int precision)
|
static double |
sin(double x)
|
static double |
sinh(double x)
|
static double |
sqrt(double x)
|
static double |
tan(double x)
|
static double |
tanh(double x)
|
static double |
toDeg(double x)
|
static double |
toRad(double x)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double PI
public static final double PI_HALF
public static final double TWO_PI
public static final double INV_PI
public static final double INV_TWO_PI
public static final double E
public static final double DEG_TO_RAD
public static final double RAD_TO_DEG
public static final double LOG10_TO_LOG2d
public static final double LOG10_TO_LOG2
| Constructor Detail |
|---|
public FastMathd()
| Method Detail |
|---|
public static final void setPrecision(int precision)
public static final int getPrecision()
public static final double sin(double x)
public static final double asin(double x)
public static final double sinh(double x)
public static final double cos(double x)
public static final double acos(double x)
public static final double cosh(double x)
public static final double tan(double x)
public static final double atan(double x)
public static final double atan2(double y,
double x)
public static final double tanh(double x)
public static final double cbrt(double x)
public static final double sqrt(double x)
public static final double invSqrt(double x)
public static final double ceil(double x)
public static final double floor(double x)
public static final double log(double x)
x -
Math.log(double)public static final double log10(double x)
public static final double log1p(double x)
public static final double log2(double x)
x -
public static final double toDeg(double x)
public static final double toRad(double x)
public static final double pow(double base,
double exp)
public static final double pow2(double base)
public static final double pow3(double base)
public static final boolean epsilonEquals(double v1,
double v2,
double epsilon)
public static final double hypot(double a,
double b)
public static final FastMathd.FRExpResultd frexp(double value,
FastMathd.FRExpResultd result)
value - the number to splitresult -
public static final FastMathd.FRExpResultd frexp(double value)
value - the number to split
public static final java.util.Random getRandom()
public static final double randomDouble()
float
value between 0.0 and 1.0 from this random
number generator's sequence. The general contract of nextFloat is that one float value, chosen (approximately) uniformly from the range 0.0f (inclusive) to 1.0f (exclusive), is pseudorandomly generated and returned. All 224 possible float values of the form m x 2-24, where m is a positive integer less than 224 , are produced with (approximately) equal probability. The method nextFloat is implemented by class Random as follows:
public float nextFloat() {
return next(24) / ((float)(1 << 24));
}
The hedge "approximately" is used in the foregoing description only
because the next method is only approximately an unbiased source of
independently chosen bits. If it were a perfect source or randomly
chosen bits, then the algorithm shown would choose float
values from the stated range with perfect uniformity.[In early versions of Java, the result was incorrectly calculated as:
This might seem to be equivalent, if not better, but in fact it introduced a slight nonuniformity because of the bias in the rounding of floating-point numbers: it was slightly more likely that the low-order bit of the significand would be 0 than that it would be 1.]return next(30) / ((float)(1 << 30));
float
value between 0.0 and 1.0 from this
random number generator's sequence.public static final double randomDouble(float max)
max - the maximum number (exclusive)
public static final double randomDouble(float min,
float max)
min - the minimum number (inclusive)max - the maximum number (exclusive)
public static final int randomInt()
public static final int randomInt(int max)
max - the maximum number (exclusive)
public static final int randomInt(int min,
int max)
min - the minimum number (inclusive)max - the maximum number (exclusive)
public static final long randomLong()
public static final long randomLong(long max)
max - the maximum number (exclusive)
public static final long randomLong(long min,
long max)
min - the minimum number (inclusive)max - the maximum number (exclusive)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||