BigDecimal.Divide Method

Definition

Overloads

Divide(BigDecimal)

Returns a BigDecimal whose value is (this / divisor), and whose preferred scale is (this.scale() - divisor.scale()); if the exact quotient cannot be represented (because it has a non-terminating decimal expansion) an ArithmeticException is thrown.

Divide(BigDecimal, MathContext)

Returns a BigDecimal whose value is (this / divisor), with rounding according to the context settings.

Divide(BigDecimal, RoundingMode)

Returns a BigDecimal whose value is (this / divisor), and whose scale is this.scale().

Divide(BigDecimal, RoundOptions)

Returns a BigDecimal whose value is (this / divisor), and whose scale is this.scale().

Divide(BigDecimal, Int32, RoundingMode)

Returns a BigDecimal whose value is (this / divisor), and whose scale is as specified.

Divide(BigDecimal, Int32, RoundOptions)

Returns a BigDecimal whose value is (this / divisor), and whose scale is as specified.

Divide(BigDecimal)

Returns a BigDecimal whose value is (this / divisor), and whose preferred scale is (this.scale() - divisor.scale()); if the exact quotient cannot be represented (because it has a non-terminating decimal expansion) an ArithmeticException is thrown.

[Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_Handler")]
public virtual Java.Math.BigDecimal? Divide (Java.Math.BigDecimal? divisor);
[<Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_Handler")>]
abstract member Divide : Java.Math.BigDecimal -> Java.Math.BigDecimal
override this.Divide : Java.Math.BigDecimal -> Java.Math.BigDecimal

Parameters

divisor
BigDecimal

value by which this BigDecimal is to be divided.

Returns

this / divisor

Attributes

Exceptions

if divisor == null.

if divisor == 0.

if the result cannot be represented exactly.

Remarks

Java documentation for java.math.BigDecimal.divide(java.math.BigDecimal).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Divide(BigDecimal, MathContext)

Returns a BigDecimal whose value is (this / divisor), with rounding according to the context settings.

[Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;Ljava/math/MathContext;)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_Ljava_math_MathContext_Handler")]
public virtual Java.Math.BigDecimal? Divide (Java.Math.BigDecimal? divisor, Java.Math.MathContext? mc);
[<Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;Ljava/math/MathContext;)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_Ljava_math_MathContext_Handler")>]
abstract member Divide : Java.Math.BigDecimal * Java.Math.MathContext -> Java.Math.BigDecimal
override this.Divide : Java.Math.BigDecimal * Java.Math.MathContext -> Java.Math.BigDecimal

Parameters

divisor
BigDecimal

value by which this BigDecimal is to be divided.

mc
MathContext

the context to use.

Returns

this / divisor, rounded as necessary.

Attributes

Exceptions

if divisor == null or mc == null.

if divisor == 0.

if mc.getRoundingMode() == UNNECESSARY and rounding is necessary according mc.getPrecision().

Remarks

Java documentation for java.math.BigDecimal.divide(java.math.BigDecimal, java.math.MathContext).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Divide(BigDecimal, RoundingMode)

Returns a BigDecimal whose value is (this / divisor), and whose scale is this.scale().

[Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;Ljava/math/RoundingMode;)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_Ljava_math_RoundingMode_Handler")]
public virtual Java.Math.BigDecimal? Divide (Java.Math.BigDecimal? divisor, Java.Math.RoundingMode? roundingMode);
[<Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;Ljava/math/RoundingMode;)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_Ljava_math_RoundingMode_Handler")>]
abstract member Divide : Java.Math.BigDecimal * Java.Math.RoundingMode -> Java.Math.BigDecimal
override this.Divide : Java.Math.BigDecimal * Java.Math.RoundingMode -> Java.Math.BigDecimal

Parameters

divisor
BigDecimal

value by which this BigDecimal is to be divided.

roundingMode
RoundingMode

rounding mode to apply.

Returns

this / divisor

Attributes

Exceptions

if divisor == null or roundingMode == null.

if divisor == 0.

if roundingMode == RoundingMode.UNNECESSARY and rounding is necessary according to the scale of this.

Remarks

Java documentation for java.math.BigDecimal.divide(java.math.BigDecimal, java.math.RoundingMode).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Divide(BigDecimal, RoundOptions)

Returns a BigDecimal whose value is (this / divisor), and whose scale is this.scale().

[Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;I)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_IHandler")]
public virtual Java.Math.BigDecimal? Divide (Java.Math.BigDecimal? divisor, Java.Math.RoundOptions roundingMode);
[<Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;I)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_IHandler")>]
abstract member Divide : Java.Math.BigDecimal * Java.Math.RoundOptions -> Java.Math.BigDecimal
override this.Divide : Java.Math.BigDecimal * Java.Math.RoundOptions -> Java.Math.BigDecimal

Parameters

divisor
BigDecimal

value by which this BigDecimal is to be divided.

roundingMode
RoundOptions

rounding mode to apply.

Returns

this / divisor

Attributes

Exceptions

if divisor == null.

if roundingMode is not a valid rounding mode.

if divisor == 0.

if roundingMode == ROUND_UNNECESSARY and rounding is necessary according to the scale of this.

Remarks

Java documentation for java.math.BigDecimal.divide(java.math.BigDecimal, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Divide(BigDecimal, Int32, RoundingMode)

Returns a BigDecimal whose value is (this / divisor), and whose scale is as specified.

[Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;ILjava/math/RoundingMode;)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_ILjava_math_RoundingMode_Handler")]
public virtual Java.Math.BigDecimal? Divide (Java.Math.BigDecimal? divisor, int scale, Java.Math.RoundingMode? roundingMode);
[<Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;ILjava/math/RoundingMode;)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_ILjava_math_RoundingMode_Handler")>]
abstract member Divide : Java.Math.BigDecimal * int * Java.Math.RoundingMode -> Java.Math.BigDecimal
override this.Divide : Java.Math.BigDecimal * int * Java.Math.RoundingMode -> Java.Math.BigDecimal

Parameters

divisor
BigDecimal

value by which this BigDecimal is to be divided.

scale
Int32

scale of the BigDecimal quotient to be returned.

roundingMode
RoundingMode

rounding mode to apply.

Returns

this / divisor

Attributes

Exceptions

if divisor == null or roundingMode == null.

if divisor == 0.

if roundingMode == RoundingMode.UNNECESSARY and rounding is necessary according to the given scale and given precision.

Remarks

Java documentation for java.math.BigDecimal.divide(java.math.BigDecimal, int, java.math.RoundingMode).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Divide(BigDecimal, Int32, RoundOptions)

Returns a BigDecimal whose value is (this / divisor), and whose scale is as specified.

[Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;II)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_IIHandler")]
public virtual Java.Math.BigDecimal? Divide (Java.Math.BigDecimal? divisor, int scale, Java.Math.RoundOptions roundingMode);
[<Android.Runtime.Register("divide", "(Ljava/math/BigDecimal;II)Ljava/math/BigDecimal;", "GetDivide_Ljava_math_BigDecimal_IIHandler")>]
abstract member Divide : Java.Math.BigDecimal * int * Java.Math.RoundOptions -> Java.Math.BigDecimal
override this.Divide : Java.Math.BigDecimal * int * Java.Math.RoundOptions -> Java.Math.BigDecimal

Parameters

divisor
BigDecimal

value by which this BigDecimal is to be divided.

scale
Int32

scale of the BigDecimal quotient to be returned.

roundingMode
RoundOptions

rounding mode to apply.

Returns

this / divisor

Attributes

Exceptions

if divisor == null.

if roundingMode is not a valid rounding mode.

if divisor == 0.

if roundingMode == ROUND_UNNECESSARY and rounding is necessary according to the given scale.

Remarks

Java documentation for java.math.BigDecimal.divide(java.math.BigDecimal, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to