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

# significantDigits(_:)

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

## Declaration

```swift
static func significantDigits(_ digits: Int) -> NumberFormatStyleConfiguration.Precision
```

## Parameters

- `digits`: The maximum number of significant digits to use when formatting values.

## Return Value

Return Value A precision that constrains formatted values to a given number 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(4))     .rounded(rule: .down)) // "123,400"

## See Also

### Precision configurations

- [significantDigits(_:)](foundation/numberformatstyleconfiguration/precision/significantdigits(_:)-2rp7g.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)
