---
title: "significantDigits(_:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/numberformatstyleconfiguration/precision/significantdigits(_:)-2rp7g"
---

# significantDigits(_:)

Returns a precision that constrains formatted values to a range of significant digits.

## Declaration

```swift
static func significantDigits<R>(_ limits: R) -> NumberFormatStyleConfiguration.Precision where R : RangeExpression, R.Bound == Int
```

## Parameters

- `limits`: A range from the minimum to the maximum number of significant digits to use when formatting values.

## Return Value

Return Value A precision that constrains formatted values to a range of significant digits.

## Discussion

Discussion When using this precision, the formatter rounds values that have more sigificant digits than the maximum of the range, as seen in the following example: let myNum = 123456.formatted(.number     .precision(.significantDigits(2...4))     .rounded(rule: .down)) // "123,400"

## See Also

### Precision configurations

- [significantDigits(_:)](foundation/numberformatstyleconfiguration/precision/significantdigits(_:)-9dvpr.md)
- [integerAndFractionLength(integerLimits:fractionLimits:)](foundation/numberformatstyleconfiguration/precision/integerandfractionlength(integerlimits:fractionlimits:).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)
