|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.resources.XMath
Simple mathematical functions. Some of these functions will be removed if JavaSoft provide a standard implementation or fix some issues in Bug Parade:
Field Summary | |
static double |
LN10
Natural logarithm of 10. |
Method Summary | |
static double |
cbrt(double x)
Combute the cubic root of the specified value. |
static int |
countFractionDigits(double value)
Count the fraction digits in the string representation of the specified value. |
static double |
fixRoundingError(double value,
int n)
Try to remove at least fraction digits in the string representation of the specified value. |
static int |
getBitCount(java.lang.Class type)
Returns the number of bits used by number of the specified type. |
static double |
hypot(double x,
double y)
Compute the hypotenuse ( sqrt(x?+y?) ). |
static boolean |
isInteger(java.lang.Class type)
Returns if the specified is one of integer types. |
static boolean |
isReal(java.lang.Class type)
Returns if the specified is one of real number types. |
static double |
log10(double x)
Compute the logarithm in base 10. |
static double |
next(double f)
Finds the least double greater than f. |
static float |
next(float f)
Finds the least float greater than f. |
static double |
pow10(double x)
Compute 10 power x. |
static double |
pow10(int x)
Compute x to the power of 10. |
static double |
previous(double f)
Finds the greatest double less than f. |
static float |
previous(float f)
Finds the greatest float less than f. |
static java.lang.Class |
primitiveToWrapper(java.lang.Class type)
Change a primitive class to its wrapper (e.g. |
static double |
rool(java.lang.Class type,
double value,
int amount)
Returns the next or previous representable number. |
static double |
round(double value,
int flu)
Round the specified value, providing that the difference between the original value and the rounded value is not greater than the specified amount of floating point units. |
static byte |
sgn(byte x)
Returns the sign of x. |
static int |
sgn(double x)
Returns the sign of x. |
static int |
sgn(float x)
Returns the sign of x. |
static int |
sgn(int x)
Returns the sign of x. |
static int |
sgn(long x)
Returns the sign of x. |
static short |
sgn(short x)
Returns 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 double LN10
Method Detail |
public static double cbrt(double x)
public static double hypot(double x, double y)
sqrt(x?+y?)
).
public static double log10(double x)
public static double pow10(double x)
public static double pow10(int x)
public static int sgn(double x)
public static int sgn(float x)
public static int sgn(long x)
public static int sgn(int x)
public static short sgn(short x)
public static byte sgn(byte x)
public static double round(double value, int flu)
value
- The value to round.flu
- The amount of floating point units.
public static double fixRoundingError(double value, int n)
Example: returns .
value
- The value to fix.n
- The minimum amount of fraction digits.
public static int countFractionDigits(double value)
Double#toString(value)
and counting the number of digits after the decimal separator.
public static float next(float f)
public static float previous(float f)
public static double next(double f)
ChoiceFormat.nextDouble(double)
public static double previous(double f)
ChoiceFormat.previousDouble(double)
public static double rool(java.lang.Class type, double value, int amount) throws java.lang.IllegalArgumentException
If the is Double
, then this method is
equivalent to invoking previous(double)
if is equals to
, or invoking next(double)
if is equals to
. If is smaller than or greater
than , then this method invokes previous(double)
or
next(double)
in a loop for times.
If the is Float
, then this method is
equivalent to invoking previous(float)
if is equals to
, or invoking next(float)
if is equals to
. If is smaller than or greater
than , then this method invokes previous(float)
or
next(float)
in a loop for times.
If the is an integer, then invoking this method is equivalent to computing .
type
- The type. Should be the class of Double
, Float
,
Long
, Integer
, Short
or Byte
.value
- The number to rool.amount
- -1 to return the previous representable number,
+1 to return the next representable number, or
0 to return the number with no change.
java.lang.IllegalArgumentException
- if is not one of supported types.public static boolean isReal(java.lang.Class type)
Float
and Double
.
type
- The type to test (may be ).
Float
or Double
.public static boolean isInteger(java.lang.Class type)
Long
, Integer
, Short
and Byte
.
type
- The type to test (may be ).
Long
, Integer
,
Short
or Byte
.public static int getBitCount(java.lang.Class type)
type
- The type (may be ).
public static java.lang.Class primitiveToWrapper(java.lang.Class type)
Double
).
If the specified class is not a primitive type, then it is returned unchanged.
type
- The primitive type (may be ).
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |