> On Nov 28, 2016, at 2:29 PM, David Sweeris via swift-users 
> <swift-users@swift.org> wrote:
> 
> Sent from my iPhone
>> On Nov 28, 2016, at 13:21, Joe Groff <jgr...@apple.com> wrote:
>> 
>> It really shouldn't be, since ExpressibleByFloatLiteral uses a binary float 
>> initial value and so doesn't guarantee decimal accuracy. I'd recommend using 
>> init(mantissa:exponent:isNegative:) instead, and minimizing any conversions 
>> between Double and Decimal.
> 
> That's what I was worried about... What's the "correct" way to express a 
> literal as a Decimal, then? Use a string literal, `"2.1"`, instead of a float 
> literal, `2.1`?

Yes. Adding decimal literals would be a nice improvement at some future point, 
strings are the correct solution until then.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to