public final class XMath extends Object
Modifier and Type | Field and Description |
---|---|
static double |
LN10
Deprecated.
Was for
log10(double) internal usage only. |
Modifier and Type | Method and Description |
---|---|
static int |
countFractionDigits(double value)
Deprecated.
Moved to
XMath . |
static double |
fixRoundingError(double value,
int n)
Deprecated.
Moved to
XMath . |
static int |
getBitCount(Class<?> type)
Deprecated.
Moved to
Classes . |
static double |
hypot(double x,
double y)
Deprecated.
Replaced by
Math.hypot(double, double) . |
static boolean |
isInteger(Class<?> type)
Deprecated.
Moved to
Classes . |
static boolean |
isReal(Class<?> type)
Deprecated.
Moved to
Classes . |
static double |
log10(double x)
Deprecated.
Replaced by
Math.log10(double) . |
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)
Deprecated.
Moved to
XMath . |
static double |
pow10(int x)
Deprecated.
Moved to
XMath . |
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 Class<?> |
primitiveToWrapper(Class<?> type)
Deprecated.
Moved to
Classes . |
static double |
rool(Class type,
double value,
int amount)
Returns the next or previous representable number.
|
static double |
round(double value,
int flu)
Deprecated.
Moved to
XMath . |
static byte |
sgn(byte x)
Deprecated.
Moved to
XMath . |
static int |
sgn(double x)
Deprecated.
Moved to
XMath . |
static int |
sgn(float x)
Deprecated.
Moved to
XMath . |
static int |
sgn(int x)
Deprecated.
Moved to
XMath . |
static int |
sgn(long x)
Deprecated.
Moved to
XMath . |
static short |
sgn(short x)
Deprecated.
Moved to
XMath . |
static float |
toNaN(int index)
Deprecated.
Moved to
XMath . |
static <T> T |
valueOf(Class<T> type,
String value)
Deprecated.
Moved to
Classes . |
public static final double LN10
log10(double)
internal usage only.@Deprecated public static double hypot(double x, double y)
Math.hypot(double, double)
.sqrt(x²+y²)
).@Deprecated public static double log10(double x)
Math.log10(double)
.@Deprecated public static double pow10(double x)
XMath
.@Deprecated public static double pow10(int x)
XMath
.@Deprecated public static int sgn(double x)
XMath
.NaN
and +1 if x is positive.Math.signum(double)
@Deprecated public static int sgn(float x)
XMath
.NaN
and +1 if x is positive.Math.signum(float)
@Deprecated public static int sgn(long x)
XMath
.@Deprecated public static int sgn(int x)
XMath
.@Deprecated public static short sgn(short x)
XMath
.@Deprecated public static byte sgn(byte x)
XMath
.@Deprecated public static double round(double value, int flu)
XMath
.value
- The value to round.flu
- The amount of floating point units.value
if it was not close enough to an integer.@Deprecated public static double fixRoundingError(double value, int n)
XMath
.n
fraction digits in the string representation of the
specified value. This method try small changes to value
, by adding or substracting a
maximum of 4 ulps. If there is no small change that remove at least n
fraction
digits, then the value is returned unchanged. This method is used for hiding rounding errors,
like in conversions from radians to degrees.
Example: XMath.fixRoundingError(-61.500000000000014, 12)
returns -61.5
.
value
- The value to fix.n
- The minimum amount of fraction digits.value
if there is no small change that
remove at least n
fraction digits.@Deprecated public static int countFractionDigits(double value)
XMath
.Double#toString(value)
and counting the number of digits after the decimal separator.public static float next(float f)
NaN
, returns same value.public static float previous(float f)
NaN
, returns same value.public static double next(double f)
NaN
, returns same value.ChoiceFormat.nextDouble(double)
public static double previous(double f)
NaN
, returns same value.ChoiceFormat.previousDouble(double)
public static double rool(Class type, double value, int amount) throws IllegalArgumentException
amount
is equals to 0
,
then this method returns the value
unchanged. Otherwise, The operation performed
depends on the specified type
:
If the type
is Double
, then this method is equivalent to invoking
previous(double)
if amount
is equals to -1
, or invoking next(double)
if amount
is equals to +1
. If amount
is smaller
than -1
or greater than +1
, then this method invokes previous(double)
or next(double)
in a loop for abs(amount)
times.
If the type
is Float
, then this method is equivalent to invoking
previous(float)
if amount
is equals to -1
, or invoking next(float)
if amount
is equals to +1
. If amount
is smaller
than -1
or greater than +1
, then this method invokes previous(float)
or next(float)
in a loop for abs(amount)
times.
If the type
is an integer, then invoking this method
is equivalent to computing value + amount
.
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.double
.IllegalArgumentException
- if type
is not one of supported types.@Deprecated public static float toNaN(int index) throws IndexOutOfBoundsException
XMath
.NaN
number for the specified index. Valid NaN numbers have bit
fields ranging from 0x7f800001
through 0x7fffffff
or 0xff800001
through 0xffffffff
. The standard Float.NaN
has bit fields 0x7fc00000
.index
- The index, from -2097152 to 2097151 inclusive.NaN
values as a float.IndexOutOfBoundsException
- if the specified index is out of bounds.@Deprecated public static boolean isReal(Class<?> type)
Classes
.@Deprecated public static boolean isInteger(Class<?> type)
Classes
.@Deprecated public static int getBitCount(Class<?> type)
Classes
.type
- The type (may be null
).@Deprecated public static Class<?> primitiveToWrapper(Class<?> type)
Classes
.double
to Double
). If the
specified class is not a primitive type, then it is returned unchanged.type
- The primitive type (may be null
).@Deprecated public static <T> T valueOf(Class<T> type, String value) throws IllegalArgumentException, NumberFormatException
Classes
.Boolean
, Integer
, Double
, etc. according the specified
type.type
- The requested type.value
- the value to parse.null
if value
was null.IllegalArgumentException
- if type
is not a recognized type.NumberFormatException
- if the string value is not parseable as a number of the
specified type.Copyright © 1996–2019 Geotools. All rights reserved.