A class that defines a rounding precision based on a number of fraction places and optionally significant digits to be used when formatting numbers in NumberFormatter. More...
#include <numberformatter.h>
Public Member Functions | |
| Precision | withMinDigits (int32_t minSignificantDigits) const |
| Ensure that no less than this number of significant digits are retained when rounding according to fraction rules. | |
| Precision | withMaxDigits (int32_t maxSignificantDigits) const |
| Ensure that no more than this number of significant digits are retained when rounding according to fraction rules. | |
Friends | |
| class | Precision |
A class that defines a rounding precision based on a number of fraction places and optionally significant digits to be used when formatting numbers in NumberFormatter.
To create a FractionPrecision, use one of the factory methods on Precision.
Definition at line 776 of file numberformatter.h.
| Precision icu::number::FractionPrecision::withMaxDigits | ( | int32_t | maxSignificantDigits | ) | const |
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".
| maxSignificantDigits | Round the number to no more than this number of significant figures. |
| Precision icu::number::FractionPrecision::withMinDigits | ( | int32_t | minSignificantDigits | ) | const |
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".
| minSignificantDigits | The number of significant figures to guarantee. |
1.6.1