[swift-users] Strange behavior creating Double from String on Mac and Linux

Krystof Beuermann krystof.beuermann at gmx.de
Wed Jan 11 16:31:51 CST 2017

Hi Guys,

i just stumbled over this different behavior between Mac and Linux:

MacOS Sierra 10.12.1 Swift 3.0.2 REPL

 1> import Foundation
  2. let nf = NumberFormatter()
  3. print(nf.string(for: (Double("1")?.rounded()) as Any) as Any)
  4. print(nf.string(for: (Double("1")!.rounded()) as Any) as Any)


On Linux (http://swiftlang.ng.bluemix.net/#/repl/5876ac525784322e15d09920) the same code prints


Is this a feature or a bug? Can anyone explain this?

Thanks for you help!

Krystof Beuermann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170111/6d362df5/attachment.html>

More information about the swift-users mailing list