Precision.Increment(BigDecimal) 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.
Show numbers rounded if necessary to the closest multiple of a certain rounding increment.
[Android.Runtime.Register("increment", "(Ljava/math/BigDecimal;)Landroid/icu/number/Precision;", "", ApiSince=30)]
public static Android.Icu.Number.Precision? Increment (Java.Math.BigDecimal? roundingIncrement);
[<Android.Runtime.Register("increment", "(Ljava/math/BigDecimal;)Landroid/icu/number/Precision;", "", ApiSince=30)>]
static member Increment : Java.Math.BigDecimal -> Android.Icu.Number.Precision
Parameters
- roundingIncrement
- BigDecimal
The increment to which to round numbers.
Returns
A Precision for chaining or passing to the NumberFormatter precision() setter.
- Attributes
Remarks
Show numbers rounded if necessary to the closest multiple of a certain rounding increment. For example, if the rounding increment is 0.5, then round 1.2 to 1 and round 1.3 to 1.5.
In order to ensure that numbers are padded to the appropriate number of fraction places, set the scale on the rounding increment BigDecimal. For example, to round to the nearest 0.5 and always display 2 numerals after the decimal separator (to display 1.2 as "1.00" and 1.3 as "1.50"), you can run:
Precision.increment(new BigDecimal("0.50"))
For more information on the scale of Java BigDecimal, see java.math.BigDecimal#scale()
.
Java documentation for android.icu.number.Precision.increment(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.