BigDecimal.divide

BigDecimal.divide

Class Overview | Class Members | This Package | All Packages

Syntax 1
public BigDecimal divide( BigDecimal val, int scale, int roundingMode ) throws ArithmeticException, IllegalArgumentException
Description
Returns a BigDecimal whose value is (this / val), and whose scale is as specified. If rounding must be performed to generate a result with the given scale, the specified rounding mode is applied. Throws an ArithmeticException if val == 0, scale < 0, or the rounding mode is ROUND_UNNECESSARY and the specified scale is insufficient to represent the result of the division exactly. Throws an IllegalArgumentException if roundingMode does not represent a valid rounding mode.



Syntax 2
public BigDecimal divide( BigDecimal val, int roundingMode ) throws ArithmeticException, IllegalArgumentException
Description
Returns a BigDecimal whose value is (this / val), and whose scale is this.scale(). If rounding must be performed to generate a result with the given scale, the specified rounding mode is applied. Throws an ArithmeticException if val == 0. Throws an IllegalArgumentException if roundingMode does not represent a valid rounding mode.