I spent hours trying to find the problem but I didn't find it.
Here is the problem :
let n = 4.99/Float(1)
print("n : \(n)")
let n1 = Float(10000)*n
print("n1 : \(n1)")
let n2 = floor(n1)
print("n2 : \(n2)")
let n3 = Int(n1)
print("n3 : \(n3)")
The result in the console is :
n : 4.99
n1 : 49900.0
n2 : 49899.0
n3 : 49899.0
My question is why n2 and n3 are equal to 49899. It should be equal to 49900.0
I tried to write
let n2 = floor(49900.0)
and it works perfectly. It shows me 49900.0. It's what I want.
I really don't know what I'm not doing good.