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

Janosch Hildebrand jnosh at jnosh.com
Thu Jan 7 17:11:01 CST 2016

> On 06 Jan 2016, at 03:08, Chris Lattner <clattner at apple.com> wrote:
>> On Jan 5, 2016, at 4:41 PM, Janosch Hildebrand via swift-evolution <swift-evolution at swift.org> wrote:
>> I also think that Float and Double are not ideal type names but I also agree with many of the concerns that have been raised.
>> Why not simply use (the existing) Float32 and Float64 while keeping everything else equal?
> What perceived problem are you solving?
> -Chris

a) That ‘Double’ is not a great type name and the Float/Double combination is inconsistent naming.
(b) Trying to direct this discussion into a (from my point of view) more reasonable direction; i.e. away from 64-bit Float and CGFloat-reborn)

Although I wouldn’t go so far as to call Float/Double a problem, more of a nitpick.
I hadn’t given it any thought really before this thread so this is just me thinking out loud…

To me, FloatXX has the following advantages:
Consistent naming: Float16, Float32, Float80, Float128
The names contain information about the type (what is it, how large is it) that is very accessible
Aligns nicely with the integer types

And the following obvious disadvantages:
Float and Double are much more prevalent (
Float and Double are shorter

However I think the decision to go with Float/Double is very reasonable as these advantages are pretty minor and on the other end of the scale is a lot of historical precedent. Hence the ‘can we get people used to and using FloatXX while still retaining Float & Double?’ ;-)

- Janosch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160108/adee65b2/attachment.html>

More information about the swift-evolution mailing list