Skip to content

Commit 5176f31

Browse files
committed
Foundation: swift 5.1 deprecation sweep (NFC)
Replace `rint` and `nearbyint` to `.rounded(.toNearestOrEven)` as recommended by the deprecation warnings when building Foundation. NFC.
1 parent 3ebeed2 commit 5176f31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Foundation/CGFloat.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -777,12 +777,12 @@ public func tgamma(_ x: CGFloat) -> CGFloat {
777777

778778
@_transparent
779779
public func nearbyint(_ x: CGFloat) -> CGFloat {
780-
return CGFloat(nearbyint(x.native))
780+
return CGFloat(x.native.rounded(.toNearestOrEven))
781781
}
782782

783783
@_transparent
784784
public func rint(_ x: CGFloat) -> CGFloat {
785-
return CGFloat(rint(x.native))
785+
return CGFloat(x.native.rounded(.toNearestOrEven))
786786
}
787787

788788
@_transparent

0 commit comments

Comments
 (0)