as describe in the title, the Swift String() function does not work as I expected:
String(format: "%.1f", 8.25)
does NOT return 8.3 as expected (rounded) but 8.2.
If I use
String(format: "%.1f", 8.251)
it return 8.3, so it does not simply cut the place(s).
Is this how it should work or are there any explanation why this happens?
I know that there is a solution like this.
round(10*8.25)/10
I would like to understand the behaviour of the String() function.