|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jutil.math.Math
This is a general utility class for mathematical stuff.
Field Summary | |
static java.lang.String |
CVS_REVISION
|
Constructor Summary | |
Math()
|
Method Summary | |
static long |
lpower(long base,
long exponent)
public behavior pre exponent > 0; post \result == java.lang.Math.pow(base,exponent); |
static void |
main(java.lang.String[] args)
|
static double |
power(double base,
long exponent)
public behavior pre exponent > 0; post \result == java.lang.Math.pow(base,exponent); |
static double |
sign(double x)
public behavior post (x>=0) => \result == 1; post (x<0) => \result == -1; Return the sign of x |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String CVS_REVISION
Constructor Detail |
public Math()
Method Detail |
public static double sign(double x)
x
- The number of which the sign is requested.public static final long lpower(long base, long exponent)
Compute a^b when b is positive. This metod is significantly faster than Math.pow, but introduces slightly different result than Math.pow (Although I've only seen differences in the last digit up to now, and also Math.pow doesn't always return the exact same result as Matlab).
To give you an idea, it is more than 10 times faster using Sun jdk 1.4.0 on a celeron 366MHz and a P4 1.5GHz processor.
base
- The number of which the exponent'th power is requestedexponent
- The exponentpublic static final double power(double base, long exponent)
Compute a^b when b is positive. This metod is significantly faster than Math.pow, but introduces slightly different result than Math.pow (Although I've only seen differences in the last digit up to now, and also Math.pow doesn't always return the exact same result as Matlab).
To give you an idea, it is more than 10 times faster using Sun jdk 1.4.0 on a celeron 366MHz and a P4 1.5GHz processor.
base
- The number of which the exponent'th power is requestedexponent
- The exponentpublic static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |