#!/usr/local/bin/swift #!/usr/bin/env swift #if os(OSX) import Cocoa #elseif os(iOS) import UIKit #elseif os(Linux) import Glibc #endif let finish = 2.0 var d = finish / 2 var f = d for i in 0...53 { let s = String(format:"%.17g", d) if Double(s)! != d { print("Round trip failed: \(Double(s)! - d)") break; } print(s) f /= 2 d += f }