[swift-evolution] Thoughts on clarity of Double and Float type names?

John Randolph jcr at icloud.com
Wed Jan 6 02:29:45 CST 2016


> On Jan 6, 2016, at 12:01 AM, Goffredo Marocchi via swift-evolution <swift-evolution at swift.org> wrote:
>  This is the biggest problem I had with CGFloat: while it is nice at first to have a type that adapts to the device word size it runs on, I prefer to always have an explicit accuracy guarantee than worrying about my CGFloat code changing in behaviour when it runs on a 32 bit device rather than a 64 bit one.

Well, CGFloat has a specific purpose, which is for calculations having to do with things that are drawn on a display.  If you need guaranteed precision in your model layer, you should be using Double and convert as needed.

-jcr



More information about the swift-evolution mailing list