BigDecimal.SetScale Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
SetScale(Int32) |
Returns a plain |
SetScale(Int32, RoundOptions) |
Returns a plain |
SetScale(Int32)
Returns a plain BigDecimal
with a given scale.
[Android.Runtime.Register("setScale", "(I)Landroid/icu/math/BigDecimal;", "GetSetScale_IHandler", ApiSince=24)]
public virtual Android.Icu.Math.BigDecimal? SetScale (int scale);
[<Android.Runtime.Register("setScale", "(I)Landroid/icu/math/BigDecimal;", "GetSetScale_IHandler", ApiSince=24)>]
abstract member SetScale : int -> Android.Icu.Math.BigDecimal
override this.SetScale : int -> Android.Icu.Math.BigDecimal
Parameters
- scale
- Int32
The int
specifying the scale of the resulting BigDecimal
.
Returns
A plain BigDecimal
with the given scale.
- Attributes
Remarks
Returns a plain BigDecimal
with a given scale.
If the given scale (which must be zero or positive) is the same as or greater than the length of the decimal part (the scale) of this BigDecimal
then trailing zeros will be added to the decimal part as necessary.
If the given scale is less than the length of the decimal part (the scale) of this BigDecimal
then trailing digits will be removed, and in this case an ArithmeticException
is thrown if any discarded digits are non-zero.
The same as #setScale(int, int)
, where the first parameter is the scale, and the second is MathContext.ROUND_UNNECESSARY
.
Java documentation for android.icu.math.BigDecimal.setScale(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
SetScale(Int32, RoundOptions)
Returns a plain BigDecimal
with a given scale.
[Android.Runtime.Register("setScale", "(II)Landroid/icu/math/BigDecimal;", "GetSetScale_IIHandler", ApiSince=24)]
public virtual Android.Icu.Math.BigDecimal? SetScale (int scale, Android.Icu.Math.RoundOptions round);
[<Android.Runtime.Register("setScale", "(II)Landroid/icu/math/BigDecimal;", "GetSetScale_IIHandler", ApiSince=24)>]
abstract member SetScale : int * Android.Icu.Math.RoundOptions -> Android.Icu.Math.BigDecimal
override this.SetScale : int * Android.Icu.Math.RoundOptions -> Android.Icu.Math.BigDecimal
Parameters
- scale
- Int32
The int
specifying the scale of the resulting BigDecimal
.
- round
- RoundOptions
The int
rounding mode to be used for the division (see the MathContext
class).
Returns
A plain BigDecimal
with the given scale.
- Attributes
Remarks
Returns a plain BigDecimal
with a given scale.
If the given scale (which must be zero or positive) is the same as or greater than the length of the decimal part (the scale) of this BigDecimal
then trailing zeros will be added to the decimal part as necessary.
If the given scale is less than the length of the decimal part (the scale) of this BigDecimal
then trailing digits will be removed, and the rounding mode given by the second parameter is used to determine if the remaining digits are affected by a carry. In this case, an IllegalArgumentException
is thrown if round
is not a valid rounding mode.
If round
is MathContext.ROUND_UNNECESSARY
, an ArithmeticException
is thrown if any discarded digits are non-zero.
Java documentation for android.icu.math.BigDecimal.setScale(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.