To create a FractionPrecision, use one of the factory methods on Precision.
NumberFormatter
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Precision | Returns: A Precision for chaining or passing to the NumberFormatter rounding() setter.Round the number to no more than this number of significant figures. maxSignificantDigits)Ensure that no more than this number of significant digits are retained when rounding according to fraction rules. |
| public Precision | Returns: A Precision for chaining or passing to the NumberFormatter rounding() setter.The number of significant figures to guarantee. minSignificantDigits)Ensure that no less than this number of significant digits are retained when rounding according to fraction rules. |
| public Precision | Returns: A precision for chaining or passing to the NumberFormatter precision() setter.Pad trailing zeros to achieve this minimum number of significant digits. minSignificantDigits, int Round the number to achieve this maximum number of significant digits. maxSignificantDigits, NumberFormatter.How to disambiguate between fraction digits and significant digits. priorityOverride maximum fraction digits with maximum significant digits depending on the magnitude of the number. |
| FractionPrecision | back to summary |
|---|---|
| pack-priv FractionPrecision() | |
| withMaxDigits | back to summary |
|---|---|
| public Precision withMaxDigits(int maxSignificantDigits) Ensure that no more than this number of significant digits are retained when rounding according to fraction rules. For example, with integer rounding, the number 123.4 becomes "123". However, with maximum figures set to 2, 123.4 becomes "120" instead. This setting does not affect the number of trailing zeros. For example, with fixed fraction of 2, 123.4 would become "120.00".
This is equivalent to
| |
| withMinDigits | back to summary |
|---|---|
| public Precision withMinDigits(int minSignificantDigits) Ensure that no less than this number of significant digits are retained when rounding according to fraction rules. For example, with integer rounding, the number 3.141 becomes "3". However, with minimum figures set to 2, 3.141 becomes "3.1" instead. This setting does not affect the number of trailing zeros. For example, 3.01 would print as "3", not "3.0".
This is equivalent to
| |
| withSignificantDigits | back to summary |
|---|---|
| public Precision withSignificantDigits(int minSignificantDigits, int maxSignificantDigits, NumberFormatter. Override maximum fraction digits with maximum significant digits depending on the magnitude of the number. See UNumberRoundingPriority.
| |