|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jstatcom.util.UMath
public final class UMath
This class is a collection of some mathematical functions. It can be used in
addition to the Math class.
| Method Summary | |
|---|---|
static double[] |
base10(double arg)
Transforms arbitrary double values to a
double in the interval (-10,-1] or [1,10) and a power of
10. |
static int |
closestMultiple(int value,
int unit)
Computes the closest multiple of unit for
value. |
static double |
round(double arg,
int n)
Rounds the arg to a number with n decimal
digits, for example 2.368=round(2.367849,3) If
arg is NaN or +/-INF, then arg is returned. |
static int |
sign(int arg)
Returns -1 if arg is smaller than zero and 1 if it is
greater or equal to zero. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static double[] base10(double arg)
double values to a
double in the interval (-10,-1] or [1,10) and a power of
10. It breaks number to a number of the form #.####... and a power of 10.
{ mant,pow } = base10(arg) with mant * 10^pow == arg
returnValue[0]=mant, returnValue[1]=pow.
If arg is NaN or +/-INF, then {arg, 0} is
returned.
arg - the number to break
double array
double[0] the mantisse
double[1] the power of 10
public static int closestMultiple(int value,
int unit)
unit for
value. If value is just in the middle
between two multiples of unit, the higher multiple is
choosen, for example 15 == closestMultiple(13, 5),
10 == closestMultiple(12, 5), 8 == closestMultiple(7, 4).
value - defines a closest multiple of unitunit - defines the steps
unit for value,
returns value if (unit == 1), returns 0
if (unit == 0)
public static double round(double arg,
int n)
arg to a number with n decimal
digits, for example 2.368=round(2.367849,3) If
arg is NaN or +/-INF, then arg is returned.
arg - the number to roundn - the number of decimal digits to round for
public static int sign(int arg)
arg is smaller than zero and 1 if it is
greater or equal to zero.
arg - the number to check the sign for
if (arg < 0), otherwise 1
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||