public final class XMath extends Object
Modifier and Type | Method and Description |
---|---|
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 |
previous(double f)
Finds the greatest double less than f.
|
static float |
previous(float f)
Finds the greatest float less than f.
|
static double |
rool(Class type,
double value,
int amount)
Returns the next or previous representable number.
|
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.Copyright © 1996–2022 Geotools. All rights reserved.