I am trying to round a number to 7 decimal places by converting my input number to a string and then back to a double. The value of the string is how I would like it, but when converting it back to a double more decimal places are revealed. Any remedy for this situation?
let inputNumber: Double = 99.99990338164251
let roundedString = String(format: "%.7f", inputNumber) //"99.9999034"
let outputNumber = Double(roundedString) //99.99990339999999