---
title: "integerAndFractionLength(integerLimits:fractionLimits:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/numberformatstyleconfiguration/precision/integerandfractionlength(integerlimits:fractionlimits:)"
---

# integerAndFractionLength(integerLimits:fractionLimits:)

Returns a precision that constrains formatted values to ranges of allowed digits in the integer and fraction parts.

## Declaration

```swift
static func integerAndFractionLength<R1, R2>(integerLimits: R1, fractionLimits: R2) -> NumberFormatStyleConfiguration.Precision where R1 : RangeExpression, R2 : RangeExpression, R1.Bound == Int, R2.Bound == Int
```

## Parameters

- `integerLimits`: A range from the minimum to the maximum number of digits to use when formatting the integer part of a number.
- `fractionLimits`: A range from the minimum to the maximum number of digits to use when formatting the fraction part of a number.

## Return Value

Return Value A precision that constrains formatted values to ranges of digits in the integer and fraction parts.

## Discussion

Discussion When using this precision, the formatter rounds values that have more digits than the maximum of the range, as seen in the following example: let myNum = 12345.6789.formatted(.number     .precision(.integerAndFractionLength(integerLimits: 2...,                                          fractionLimits: 2...3))     .rounded(rule: .down)) // "12,345.678"

## See Also

### Precision configurations

- [significantDigits(_:)](foundation/numberformatstyleconfiguration/precision/significantdigits(_:)-2rp7g.md)
- [significantDigits(_:)](foundation/numberformatstyleconfiguration/precision/significantdigits(_:)-9dvpr.md)
- [integerAndFractionLength(integer:fraction:)](foundation/numberformatstyleconfiguration/precision/integerandfractionlength(integer:fraction:).md)
- [integerLength(_:)](foundation/numberformatstyleconfiguration/precision/integerlength(_:)-u8ua.md)
- [integerLength(_:)](foundation/numberformatstyleconfiguration/precision/integerlength(_:)-1njyz.md)
- [fractionLength(_:)](foundation/numberformatstyleconfiguration/precision/fractionlength(_:)-w6fk.md)
- [fractionLength(_:)](foundation/numberformatstyleconfiguration/precision/fractionlength(_:)-3wkd9.md)
