# Compiling with swift-numerics failed with error in ApproximateEquality.swift

**URL:** <https://forums.swift.org/t/compiling-with-swift-numerics-failed-with-error-in-approximateequality-swift/54512>\
**Category:** Swift Numerics\
**Created:** [January 8, 2022, 10:44am UTC](https://forums.swift.org/t/compiling-with-swift-numerics-failed-with-error-in-approximateequality-swift/54512 "2022-01-08T10:44:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlanHoo1974](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@AlanHoo1974](https://forums.swift.org/u/AlanHoo1974)\
**Post date:** [January 8, 2022, 10:44am UTC](https://forums.swift.org/t/compiling-with-swift-numerics-failed-with-error-in-approximateequality-swift/54512/1 "2022-01-08T10:44:56Z")

</div>

I import a library 'Chart' as project into my project and compile, the result is failed due to an error in dependency package 'swift-numerics'.

The error indicates '_Type of expression is ambiguous without more context_' in 2 locations in _ApproximateEquality.swift_ of _RealModule_, where both imply something wrong like ' **.\magnitude**' as below.

```swift
public func isApproximatelyEqual(
    to other: Self,
    relativeTolerance: Magnitude = Magnitude.ulpOfOne.squareRoot(),
    norm: (Self) -> Magnitude = \.magnitude
  ) -> Bool

```

and

```swift
public func isApproximatelyEqual(
    to other: Self,
    absoluteTolerance: Magnitude,
    relativeTolerance: Magnitude = 0
  ) -> Bool {
    self.isApproximatelyEqual(
      to: other,
      absoluteTolerance: absoluteTolerance,
      relativeTolerance: relativeTolerance,
      norm: \.magnitude
    )
  }

```

Xcode: 11.3.1  
Swift: 5

---

<div class="post-metadata">

**Author:** ![Finagolfin](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/finagolfin/32/34388_2.png) [@Finagolfin](https://forums.swift.org/u/Finagolfin)\
**Post date:** [January 10, 2022, 8:35am UTC](https://forums.swift.org/t/compiling-with-swift-numerics-failed-with-error-in-approximateequality-swift/54512/2 "2022-01-10T08:35:22Z")

</div>

I suggest reporting that problem to the author of the Chart library. There's not much we can do here without more information.

---

<div class="post-metadata">

**Author:** ![Daniel\_Mullenborn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/daniel_mullenborn/32/340_2.png) [@Daniel\_Mullenborn](https://forums.swift.org/u/Daniel_Mullenborn)\
**Post date:** [January 10, 2022, 6:35pm UTC](https://forums.swift.org/t/compiling-with-swift-numerics-failed-with-error-in-approximateequality-swift/54512/3 "2022-01-10T18:35:57Z")

</div>

I've seen the error before, it's your Swift version, try compiling it with 5.4 or 5.5. The Swift 5.0 compiler does not like swift-numerics.
