# NumberFormatter.RoundingPriority

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# RoundingPriority

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/icu/number/NumberFormatter.RoundingPriority "View this page in Java")  

```
class RoundingPriority
```

|---|---|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                |||
| ↳ | [kotlin.Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\<[android.icu.number.NumberFormatter.RoundingPriority](https://developer.android.com/reference/kotlin/android/icu/number/NumberFormatter.RoundingPriority#)\> ||
|   | ↳ | [android.icu.number.NumberFormatter.RoundingPriority](https://developer.android.com/reference/kotlin/android/icu/number/NumberFormatter.RoundingPriority#) |

|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [NumberFormatter.RoundingPriority.RELAXED](https://developer.android.com/reference/kotlin/android/icu/number/NumberFormatter.RoundingPriority#ENUM_VALUE:RELAXED),[NumberFormatter.RoundingPriority.STRICT](https://developer.android.com/reference/kotlin/android/icu/number/NumberFormatter.RoundingPriority#ENUM_VALUE:STRICT) |-------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------| | [NumberFormatter.RoundingPriority.RELAXED](https://developer.android.com/reference/kotlin/android/icu/number/NumberFormatter.RoundingPriority#ENUM_VALUE:RELAXED) | Favor greater precision by relaxing one of the rounding constraints.      | | [NumberFormatter.RoundingPriority.STRICT](https://developer.android.com/reference/kotlin/android/icu/number/NumberFormatter.RoundingPriority#ENUM_VALUE:STRICT)   | Favor adherence to all rounding constraints by producing lower precision. | |

An enum declaring how to resolve conflicts between maximum fraction digits and maximum significant digits.

There are two modes, RELAXED and STRICT:

- RELAXED: Relax one of the two constraints (fraction digits or significant digits) in order to round the number to a higher level of precision.
- STRICT: Enforce both constraints, resulting in the number being rounded to a lower level of precision.

The default settings for compact notation rounding are Max-Fraction = 0 (round to the nearest integer), Max-Significant = 2 (round to 2 significant digits), and priority RELAXED (choose the constraint that results in more digits being displayed).

Conflicting*minimum*fraction and significant digits are always resolved in the direction that results in more trailing zeros.

Example 1: Consider the number 3.141, with various different settings:

- Max-Fraction = 1: "3.1"
- Max-Significant = 3: "3.14"

The rounding priority determines how to resolve the conflict when both Max-Fraction and Max-Significant are set. With RELAXED, the less-strict setting (the one that causes more digits to be displayed) will be used; Max-Significant wins. With STRICT, the more-strict setting (the one that causes fewer digits to be displayed) will be used; Max-Fraction wins.

Example 2: Consider the number 8317, with various different settings:

- Max-Fraction = 1: "8317"
- Max-Significant = 3: "8320"

Here, RELAXED favors Max-Fraction and STRICT favors Max-Significant. Note that this larger number caused the two modes to favor the opposite result.

## Summary

|                                                                                                 Enum values                                                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [RELAXED](https://developer.android.com/reference/kotlin/android/icu/number/NumberFormatter.RoundingPriority#ENUM_VALUE:RELAXED) Favor greater precision by relaxing one of the rounding constraints.    |
| [STRICT](https://developer.android.com/reference/kotlin/android/icu/number/NumberFormatter.RoundingPriority#ENUM_VALUE:STRICT) Favor adherence to all rounding constraints by producing lower precision. |

## Enum values

### RELAXED

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
enum val RELAXED : NumberFormatter.RoundingPriority
```

Favor greater precision by relaxing one of the rounding constraints.  

### STRICT

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
enum val STRICT : NumberFormatter.RoundingPriority
```

Favor adherence to all rounding constraints by producing lower precision.