Skip to content

Commit d74597c

Browse files
committed
Further cleanup allowed by FloatingPoint implying Magnitude == Self
We no longer need to have a separate `abs` defined on FloatingPoint; we can use the existing function defined on `SignedNumeric` instead. Additionally mark `fabs` deprecated in favor of the Swift name `abs`; we don't need to have two names for the same function.
1 parent 7208f96 commit d74597c

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

stdlib/public/Platform/tgmath.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import SwiftShims
1414

1515
// Generic functions implementable directly on FloatingPoint.
1616
@_transparent
17-
public func fabs<T: FloatingPoint>(_ x: T) -> T
18-
where T.Magnitude == T {
17+
@available(swift, deprecated: 4.2, renamed: "abs")
18+
public func fabs<T: FloatingPoint>(_ x: T) -> T {
1919
return x.magnitude
2020
}
2121

stdlib/public/core/FloatingPoint.swift.gyb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2501,13 +2501,6 @@ where Self.RawSignificand : FixedWidthInteger,
25012501

25022502
% end
25032503

2504-
/// Returns the absolute value of `x`.
2505-
@inlinable // FIXME(sil-serialize-all)
2506-
@_transparent
2507-
public func abs<T : FloatingPoint>(_ x: T) -> T where T.Magnitude == T {
2508-
return x.magnitude
2509-
}
2510-
25112504
extension FloatingPoint {
25122505
@inlinable // FIXME(sil-serialize-all)
25132506
@available(swift, obsoleted: 4, message: "Please use operators instead.")

0 commit comments

Comments
 (0)