正确制定 switch 中的 if 语句

Correctly formulate if statement in switch

这可能是一个非常初级的问题,但我正在尝试使用 if 语句,下面的示例将无法处理错误 "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions"。有人知道我做错了什么吗?

let a = 4

let b = 3

let c = 10

let d = 2


if ((sqrt((a - b)^2 + (c - d)^2)) > 100) {
              print("Yes")
        }

编辑:我知道我犯了一些错误,现在可以使用:

var a = 4

var b = 3

var c = 10

var d = 2

var e = (a-b)

var f = (c-d)

var g = (e*e)

var h = (f*f)

var j = Double(g+h)

if (j.squareRoot() > 5) {
              print("Yes")
      }

使用更好的类型!

import simd

distance([4, 10] as SIMD2<Double>, [3, 2]) > 100

如果您真的需要使用这些整数……

public extension SIMD where Scalar: FloatingPoint {
  init<Integer: BinaryInteger>(_ integers: Integer...) {
    self.init( integers.map(Scalar.init) )
  }
}

distance( SIMD2<Double>(a, c), .init(b, d) ) > 100