[swift-users] Decimal to Double?
phausler at apple.com
Mon Nov 28 09:48:55 CST 2016
This might be a bit nicer since that is relying on NSNumber bridges. You can bridge to NSDecimalNumber directly like this:
(Decimal(1.0) as NSDecimalNumber).doubleValue
(but perhaps we should consider adding initializers that follow the same pattern as Double that don’t have to bridge to solve the problem)
> On Nov 28, 2016, at 2:40 AM, Alex Blewitt via swift-users <swift-users at swift.org> wrote:
> You can wrap it with an NSDecimalNumber, and then cast it to a Double from there:
>> On 28 Nov 2016, at 10:13, Rick Mann via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
>> How do I get a Double from a Decimal?
>> Rick Mann
>> rmann at latencyzero.com <mailto:rmann at latencyzero.com>
>> swift-users mailing list
>> swift-users at swift.org
> swift-users mailing list
> swift-users at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users