What could be the reason that 0.4 >= 0.4 is false?
Code:
function init(self)
self.current = 0
self.addition = 0.05
self.compare = 0.4
end
function update(self, dt)
self.current = self.current + self.addition
if self.current >= self.compare then
print(self.current .. " >= " .. self.compare .. " -> true")
else
print(self.current .. " >= " .. self.compare .. " -> false")
end
end
Output:
DEBUG:SCRIPT: 0.05 >= 0.4 -> false
DEBUG:SCRIPT: 0.1 >= 0.4 -> false
DEBUG:SCRIPT: 0.15 >= 0.4 -> false
DEBUG:SCRIPT: 0.2 >= 0.4 -> false
DEBUG:SCRIPT: 0.25 >= 0.4 -> false
DEBUG:SCRIPT: 0.3 >= 0.4 -> false
DEBUG:SCRIPT: 0.35 >= 0.4 -> false
DEBUG:SCRIPT: 0.4 >= 0.4 -> false <--- What?
DEBUG:SCRIPT: 0.45 >= 0.4 -> true
DEBUG:SCRIPT: 0.5 >= 0.4 -> true
DEBUG:SCRIPT: 0.55 >= 0.4 -> true
Thanks!