ICU 75.1 75.1
Loading...
Searching...
No Matches
Public Member Functions | Friends
icu::number::IncrementPrecision Class Reference

A class that defines a rounding precision parameterized by a rounding increment to be used when formatting numbers in NumberFormatter. More...

#include <numberformatter.h>

Inheritance diagram for icu::number::IncrementPrecision:
icu::number::Precision icu::UMemory

Public Member Functions

Precision withMinFraction (int32_t minFrac) const
 Specifies the minimum number of fraction digits to render after the decimal separator, padding with zeros if necessary.
 
- Public Member Functions inherited from icu::number::Precision
Precision trailingZeroDisplay (UNumberTrailingZeroDisplay trailingZeroDisplay) const
 Configure how trailing zeros are displayed on numbers.
 

Friends

class Precision
 

Additional Inherited Members

- Static Public Member Functions inherited from icu::number::Precision
static Precision unlimited ()
 Show all available digits to full precision.
 
static FractionPrecision integer ()
 Show numbers rounded if necessary to the nearest integer.
 
static FractionPrecision fixedFraction (int32_t minMaxFractionPlaces)
 Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator).
 
static FractionPrecision minFraction (int32_t minFractionPlaces)
 Always show at least a certain number of fraction places after the decimal separator, padding with zeros if necessary.
 
static FractionPrecision maxFraction (int32_t maxFractionPlaces)
 Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator).
 
static FractionPrecision minMaxFraction (int32_t minFractionPlaces, int32_t maxFractionPlaces)
 Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator); in addition, always show at least a certain number of places after the decimal separator, padding with zeros if necessary.
 
static SignificantDigitsPrecision fixedSignificantDigits (int32_t minMaxSignificantDigits)
 Show numbers rounded if necessary to a certain number of significant digits or significant figures.
 
static SignificantDigitsPrecision minSignificantDigits (int32_t minSignificantDigits)
 Always show at least a certain number of significant digits/figures, padding with zeros if necessary.
 
static SignificantDigitsPrecision maxSignificantDigits (int32_t maxSignificantDigits)
 Show numbers rounded if necessary to a certain number of significant digits/figures.
 
static SignificantDigitsPrecision minMaxSignificantDigits (int32_t minSignificantDigits, int32_t maxSignificantDigits)
 Show numbers rounded if necessary to a certain number of significant digits/figures; in addition, always show at least a certain number of significant digits, padding with zeros if necessary.
 
static IncrementPrecision increment (double roundingIncrement)
 Show numbers rounded if necessary to the closest multiple of a certain rounding increment.
 
static IncrementPrecision incrementExact (uint64_t mantissa, int16_t magnitude)
 Version of Precision::increment() that takes an integer at a particular power of 10.
 
static CurrencyPrecision currency (UCurrencyUsage currencyUsage)
 Show numbers rounded and padded according to the rules for the currency unit.
 

Detailed Description

A class that defines a rounding precision parameterized by a rounding increment to be used when formatting numbers in NumberFormatter.

To create an IncrementPrecision, use one of the factory methods on Precision.

Stable:
ICU 60

Definition at line 953 of file numberformatter.h.

Member Function Documentation

◆ withMinFraction()

Precision icu::number::IncrementPrecision::withMinFraction ( int32_t  minFrac) const

Specifies the minimum number of fraction digits to render after the decimal separator, padding with zeros if necessary.

By default, no trailing zeros are added.

For example, if the rounding increment is 0.5 and minFrac is 2, then the resulting strings include "0.00", "0.50", "1.00", and "1.50".

Note: In ICU4J, this functionality is accomplished via the scale of the BigDecimal rounding increment.

Parameters
minFracThe minimum number of digits after the decimal separator.
Returns
A precision for chaining or passing to the NumberFormatter precision() setter.
Stable:
ICU 60

Friends And Related Symbol Documentation

◆ Precision

Definition at line 977 of file numberformatter.h.


The documentation for this class was generated from the following file: