How to get mathemical PI constant in Swift
I am trying to find a way to include the PI constant in my Swift code . I already found help in another answer, to import Darwin which I know gives me access to C functions . I also checked the Math package in Darwin and came across the following declaration: var M_PI: Double { get } /* pi */ So, I assume there is a way to use PI in the code, I just don't know how ... With Swift 3 & 4 , pi is now defined as a static variable on the floating point number types Double , Float and CGFloat , so no specific imports are required any more: Double.pi Float.pi CGFloat.pi Also note that the actual type