You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@differentiable(default) // Inherits from `P.foo(_:)`.
1811
+
funcfoo(_x: Float) ->Float {
1812
+
33
1813
+
}
1814
+
}
1815
+
1816
+
let s =S()
1817
+
let d =derivative(at: 0) { x in
1818
+
s.foo(x)
1819
+
} // ==> 42
1820
+
```
1821
+
1752
1822
### Differentiable function types
1753
1823
1754
1824
Differentiability is a fundamental mathematical concept that applies not only to
@@ -2239,13 +2309,13 @@ whether the derivative is always zero and warns the user.
2239
2309
2240
2310
```swift
2241
2311
let grad =gradient(at: 1.0) { x in
2242
-
3.squareRoot()
2312
+
Double(3).squareRoot()
2243
2313
}
2244
2314
```
2245
2315
2246
2316
```console
2247
-
test.swift:4:18: warning: result does not depend on differentiation arguments and will always have a zero derivative; do you want to add '.withoutDerivative()' to make it explicit?
2248
-
3.squareRoot()
2317
+
test.swift:4:18: warning: result does not depend on differentiation arguments and will always have a zero derivative; do you want to use 'withoutDerivative(at:)' to make it explicit?
0 commit comments