java.lang.Object | ||
↳ | java.lang.Enum<E extends java.lang.Enum<E>> | |
↳ | java.math.RoundingMode |
Specifies the rounding behavior for operations whose results cannot be represented exactly.
Enum Values | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
RoundingMode | CEILING | Rounding mode to round towards positive infinity. | |||||||||
RoundingMode | DOWN | Rounding mode where the values are rounded towards zero. | |||||||||
RoundingMode | FLOOR | Rounding mode to round towards negative infinity. | |||||||||
RoundingMode | HALF_DOWN | Rounding mode where values are rounded towards the nearest neighbor. | |||||||||
RoundingMode | HALF_EVEN | Rounding mode where values are rounded towards the nearest neighbor. | |||||||||
RoundingMode | HALF_UP | Rounding mode where values are rounded towards the nearest neighbor. | |||||||||
RoundingMode | UNNECESSARY | Rounding mode where the rounding operations throws an ArithmeticException for the case that rounding is necessary, i.e. | |||||||||
RoundingMode | UP | Rounding mode where positive values are rounded towards positive infinity and negative values towards negative infinity. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Converts rounding mode constants from class
BigDecimal into
RoundingMode values. | |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Rounding mode where the values are rounded towards zero.
Rule: x.round().abs() <_ x.abs="x.abs" code="code">
public
static
final
RoundingMode
FLOOR
Since: API Level
Rounding mode to round towards negative infinity. For positive values
this rounding mode behaves as
DOWN
, for negative values as
UP
.
Rule: x.round() <_ x="x" code="code">
public
static
final
RoundingMode
HALF_DOWN
Since: API Level
Rounding mode where values are rounded towards the nearest neighbor. Ties
are broken by rounding down.
public
static
final
RoundingMode
HALF_EVEN
Since: API Level
Rounding mode where values are rounded towards the nearest neighbor. Ties
are broken by rounding to the even neighbor.
public
static
final
RoundingMode
HALF_UP
Since: API Level
Rounding mode where values are rounded towards the nearest neighbor. Ties
are broken by rounding up.
public
static
final
RoundingMode
UNNECESSARY
Since: API Level
Rounding mode where the rounding operations throws an ArithmeticException
for the case that rounding is necessary, i.e. for the case that the value
cannot be represented exactly.
public
static
final
RoundingMode
UP
Since: API Level
Rounding mode where positive values are rounded towards positive infinity
and negative values towards negative infinity.
Rule: x.round().abs() >= x.abs()
Public Methods
public
static
RoundingMode
valueOf
(int mode)
Since: API Level 1
Converts rounding mode constants from class
BigDecimal
into
RoundingMode
values.
Parameters
|
|
---|
Returns
corresponding rounding mode object