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

Ben Rimmington me at benrimmington.com
Wed May 25 00:46:03 CDT 2016


Stephen Canon wrote:

> Making `Float` be an alias of `Float64` would just confuse people
> coming from a C-family language (as commonly implemented).

To avoid confusion, and to allow for decimal floating-point types:


    public struct Binary32: BinaryFloatingPoint
    public struct Binary64: BinaryFloatingPoint


    public typealias CFloat  = Binary32
    public typealias CDouble = Binary64

You could also have:

    public struct    Binary    /// The default, cf. Int
    public typealias BinaryMax /// The largest, cf. IntMax

-- Ben

More information about the swift-evolution mailing list