@@ -1696,48 +1696,49 @@ public protocol ElementaryFunctions {
1696
1696
...
1697
1697
}
1698
1698
1699
- public extension ElementaryFunctions where Self : Differentiable , Self == Self .TangentVector {
1699
+ public extension ElementaryFunctions
1700
+ where Self : Differentiable & FloatingPoint , Self == Self .TangentVector {
1700
1701
@inlinable
1701
1702
@derivative (of: sqrt)
1702
- func _ (_ x : Self ) -> (value: Self , differential: @differential (linear) (Self ) -> Self ) {
1703
+ static func _ (_ x : Self ) -> (value: Self , differential: @differentiable (linear) (Self ) -> Self ) {
1703
1704
(sqrt (x), { dx in (1 / 2 ) * (1 / sqrt (x)) * dx })
1704
1705
}
1705
1706
1706
1707
@inlinable
1707
1708
@derivative (of: cos)
1708
- func _ (_ x : Self ) -> (value: Self , differential: @differential (linear) (Self ) -> Self ) {
1709
+ static func _ (_ x : Self ) -> (value: Self , differential: @differentiable (linear) (Self ) -> Self ) {
1709
1710
(cos (x), { dx in - sin (x) * dx })
1710
1711
}
1711
1712
1712
1713
@inlinable
1713
1714
@derivative (of: asinh)
1714
- func _ (_ x : Self ) -> (value: Self , differential: @differential (linear) (Self ) -> Self ) {
1715
+ static func _ (_ x : Self ) -> (value: Self , differential: @differentiable (linear) (Self ) -> Self ) {
1715
1716
(asinh (x), { dx in 1 / (1 + x * x) * dx })
1716
1717
}
1717
1718
1718
1719
@inlinable
1719
1720
@derivative (of: exp)
1720
- func _ (_ x : Self ) -> (value: Self , differential: @differential (linear) (Self ) -> Self ) {
1721
+ static func _ (_ x : Self ) -> (value: Self , differential: @differentiable (linear) (Self ) -> Self ) {
1721
1722
let ret = exp (x)
1722
1723
return (ret, { dx in ret * dx })
1723
1724
}
1724
1725
1725
1726
@inlinable
1726
1727
@derivative (of: exp10)
1727
- func _ (_ x : Self ) -> (value: Self , differential: @differential (linear) (Self ) -> Self ) {
1728
+ static func _ (_ x : Self ) -> (value: Self , differential: @differentiable (linear) (Self ) -> Self ) {
1728
1729
let ret = exp10 (x)
1729
1730
return (ret, { dx in exp (10 ) * ret * dx })
1730
1731
}
1731
1732
1732
1733
@inlinable
1733
1734
@derivative (of: log)
1734
- func _ (_ x : Self ) -> (value: Self , differential: @differential (linear) (Self ) -> Self ) { dx in
1735
+ static func _ (_ x : Self ) -> (value: Self , differential: @differentiable (linear) (Self ) -> Self ) { dx in
1735
1736
(log (x), { 1 / x * dx })
1736
1737
}
1737
1738
1738
1739
@inlinable
1739
1740
@derivative (of: pow)
1740
- func _ (_ x : Self , _ y : Self ) -> (value: Self , differential: @differential (linear) (Self , Self ) -> Self ) {
1741
+ static func _ (_ x : Self , _ y : Self ) -> (value: Self , differential: @differentiable (linear) (Self , Self ) -> Self ) {
1741
1742
(pow (x, y), { (dx, dy) in
1742
1743
let l = y * pow (x, y- 1 ) * dx
1743
1744
let r = pow (x, y) * log (x) * dy
0 commit comments