Package org.zkoss.math
Class RoundingModes
- java.lang.Object
-
- org.zkoss.math.RoundingModes
-
public class RoundingModes extends java.lang.Object
Utilities to handle the rounding mode.- Author:
- tomyeh
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
toString(int roundingMode)
Returns the name of the rounding mode.static int
valueOf(java.lang.String name)
Returns the rounding mode of the specified name.
-
-
-
Method Detail
-
toString
public static final java.lang.String toString(int roundingMode)
Returns the name of the rounding mode. Possible values include- CEILING
- Rounding mode to round towards positive infinity.
- DOWN
- Rounding mode to round towards zero.
- FLOOR
- Rounding mode to round towards negative infinity.
- HALF_DOWN
- Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.
- HALF_EVEN
- Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.
- HALF_UP
- Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.
- UNNECESSARY
- Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary.
- UP
- Rounding mode to round away from zero.
-
valueOf
public static final int valueOf(java.lang.String name)
Returns the rounding mode of the specified name.- Parameters:
name
- the rounding mode's name. Allowed values include:- CEILING
- Rounding mode to round towards positive infinity.
- DOWN
- Rounding mode to round towards zero.
- FLOOR
- Rounding mode to round towards negative infinity.
- HALF_DOWN
- Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.
- HALF_EVEN
- Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.
- HALF_UP
- Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.
- UNNECESSARY
- Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary.
- UP
- Rounding mode to round away from zero.
-
-