Including some math in my code I stumbled over the constant "PI".
At least in my Xcode version 4.6 I could use either one. But what is the difference between pi
and M_PI
? The documentation is little bit tight on that topic.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- back button text does not change
- iOS (objective-c) compression_decode_buffer() retu
- how to find the index position of the ARRAY Where
相关文章
- 现在使用swift开发ios应用好还是swift?
- TCC __TCCAccessRequest_block_invoke
- ceil conterpart for Math.floorDiv in Java?
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- why 48 bit seed in util Random class?
- How can I add media attachments to my push notific
- didBeginContact:(SKPhysicsContact *)contact not in
pi
is defined in the "CarbonCore.framework" headers asbut marked as "deprecated". I assume that it is a relict from older Carbon frameworks.
M_PI
is defined as a macroin
math.h
and part of the POSIX standard.The values are identical, but you should use
M_PI
for portability reasons.(And for Swift, see How to get mathemical PI constant in Swift.)