<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NumberFormatStyleConfiguration/Precision/significantDigits(_:)-2rp7g",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation30NumberFormatStyleConfigurationO9PrecisionV17significantDigitsyAExSXRzSi5BoundRtzlFZ"
  },
  "title" : "significantDigits(_:)"
}
-->

# significantDigits(_:)

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

```
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

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

## 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:

```swift
let myNum = 123456.formatted(.number
    .precision(.significantDigits(2...4))
    .rounded(rule: .down)) // "123,400"
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)