I have one float number initialized from a json server response like 65.788, 43.77, 89, 58.86985 … I need print this with only two decimals digits. But without any round.
My problem is that while I format my float number to add only two digits, this format is applying an automatic round of the last digit.
let weight = 65.788
let string = String(format: "%.2f", weight). // -> 65.79
I’m getting 65.79 but I need get 65.78
How could get from the number of json response only two digits without rounding? Thanks!