org.geotools.util

## Class XMath

• ```public final class XMath
extends Object```
Simple mathematical functions.
Since:
2.0
Author:
Martin Desruisseaux (IRD)
• ### Method Summary

All Methods
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.
• ### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Method Detail

• #### next

`public static float next(float f)`
Finds the least float greater than f. If `NaN`, returns same value.
• #### previous

`public static float previous(float f)`
Finds the greatest float less than f. If `NaN`, returns same value.
• #### rool

```public static double rool(Class type,
double value,
int amount)
throws IllegalArgumentException```
Returns the next or previous representable number. If `amount` is equals to `0`, then this method returns the `value` unchanged. Otherwise, The operation performed depends on the specified `type`:
Parameters:
`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.
Returns:
One of previous or next representable number as a `double`.
Throws:
`IllegalArgumentException` - if `type` is not one of supported types.