[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


<http://thread.gmane.org/gmane.comp.lang.swift.evolution/2199/focus=18327>

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:

[stdlib/public/core/FloatingPointTypes.swift.gyb]

    public struct Binary32: BinaryFloatingPoint
    public struct Binary64: BinaryFloatingPoint

[stdlib/public/core/CTypes.swift]

    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