Partager via


DecimalFormat.MathContext Property

Definition

<strong>[icu]</strong> Returns the java.math.MathContext being used to round numbers. -or- <strong>[icu]</strong> <strong>Rounding and Digit Limits:</strong> Sets the java.math.MathContext used to round numbers.

public virtual Java.Math.MathContext? MathContext { [Android.Runtime.Register("getMathContext", "()Ljava/math/MathContext;", "GetGetMathContextHandler", ApiSince=24)] get; [Android.Runtime.Register("setMathContext", "(Ljava/math/MathContext;)V", "GetSetMathContext_Ljava_math_MathContext_Handler", ApiSince=24)] set; }
[<get: Android.Runtime.Register("getMathContext", "()Ljava/math/MathContext;", "GetGetMathContextHandler", ApiSince=24)>]
[<set: Android.Runtime.Register("setMathContext", "(Ljava/math/MathContext;)V", "GetSetMathContext_Ljava_math_MathContext_Handler", ApiSince=24)>]
member this.MathContext : Java.Math.MathContext with get, set

Property Value

Attributes

Remarks

Property getter documentation:

<strong>[icu]</strong> Returns the java.math.MathContext being used to round numbers.

Java documentation for android.icu.text.DecimalFormat.getMathContext().

Property setter documentation:

<strong>[icu]</strong> <strong>Rounding and Digit Limits:</strong> Sets the java.math.MathContext used to round numbers. A "math context" encodes both a rounding mode and a number of significant digits. Most users should call #setRoundingMode and/or #setMaximumSignificantDigits instead of this method.

When formatting, since no division is ever performed, the default MathContext is unlimited significant digits. However, when division occurs during parsing to correct for percentages and multipliers, a MathContext of 34 digits, the IEEE 754R Decimal128 standard, is used by default. If you require more than 34 digits when parsing, you can set a custom MathContext using this method.

Java documentation for android.icu.text.DecimalFormat.setMathContext(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