NumberFormatterSettings.Precision(Precision) 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.
Specifies the rounding precision to use when formatting numbers.
[Android.Runtime.Register("precision", "(Landroid/icu/number/Precision;)Landroid/icu/number/NumberFormatterSettings;", "GetPrecision_Landroid_icu_number_Precision_Handler", ApiSince=30)]
public virtual Java.Lang.Object? Precision (Android.Icu.Number.Precision? precision);
[<Android.Runtime.Register("precision", "(Landroid/icu/number/Precision;)Landroid/icu/number/NumberFormatterSettings;", "GetPrecision_Landroid_icu_number_Precision_Handler", ApiSince=30)>]
abstract member Precision : Android.Icu.Number.Precision -> Java.Lang.Object
override this.Precision : Android.Icu.Number.Precision -> Java.Lang.Object
Parameters
- precision
- Precision
The rounding precision to use.
Returns
The fluent chain.
- Attributes
Remarks
Specifies the rounding precision to use when formatting numbers.
<ul> <li>Round to 3 decimal places: "3.142" <li>Round to 3 significant figures: "3.14" <li>Round to the closest nickel: "3.15" <li>Do not perform rounding: "3.1415926..." </ul>
Pass this method the return value of one of the factory methods on Precision
. For example:
NumberFormatter.with().precision(Precision.fixedFraction(2))
In most cases, the default rounding precision is to round to 6 fraction places; i.e., Precision.maxFraction(6)
. The exceptions are if compact notation is being used, then the compact notation rounding precision is used (see Notation#compactShort
for details), or if the unit is a currency, then standard currency rounding is used, which varies from currency to currency (see Precision#currency
for details).
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.