I was trying some things in Xcode, and ran into an unexplained situation where Xcode gives me a wrong result for a simple division:
let a : Double = 0.235
let b : Double = 0.001
let nrOfDivisions = a / b
print("Divisions: ", nrOfDivisions) //prints 234.99999999999997
Strange enough, if I divide from 0.230 ... 0.234
to the same amount of 0.001
, I get correct results, but starting from 0.235 ... 0.239
I get these wrong results.
I've tested now with 0.225, 0.226, 0.227, 0.245, 0.246, 0.247
and they all divide correctly.
What might be the issue here? It is a bug in Xcode, or am I missing something?