-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[stdlib] Replacing M_PI with .pi #6802
Conversation
@swift-ci Please test |
Build failed |
@swift-ci Please smoke test and merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few simplifications are possible because CGFloat also has .pi
, whereas M_PI was Double. Those may be outside the scope of this change, however.
@@ -124,7 +124,7 @@ public struct AffineTransform : ReferenceConvertible, Hashable, CustomStringConv | |||
[ 0 0 1 ] | |||
*/ | |||
public init(rotationByDegrees angle: CGFloat) { | |||
let α = Double(angle) * M_PI / 180.0 | |||
let α = Double(angle) * .pi / 180.0 | |||
self.init(rotationByRadians: CGFloat(α)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could be cleaned up further, I think; there's no long any need for the conversions.
self.init(rotationByRadians: angle * .pi / 180)
Possibly outside the scope of this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. right! CGFloat
conforms to the same protocol. Makes perfect sense. Thanks!
@@ -169,19 +169,19 @@ class TestAffineTransform : TestAffineTransformSuper { | |||
checkPointTransformation(noop, point: point, expectedPoint: point) | |||
|
|||
var tenEighty = AffineTransform.identity | |||
tenEighty.rotate(byRadians: CGFloat(6 * M_PI)) | |||
tenEighty.rotate(byRadians: CGFloat(6 * Double.pi)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, these could just be tenEighty.rotate(byRadians: 6 * .pi)
.
@swift-ci Please test and merge |
M_PI
has recently been deprecated. Replacing it's usages to avoid compilation warnings.