LUA data comparison is not BUG BUG ????? Gangster help look

function test(money)
	for i=1,0.1,-0.1 do 
	   if tonumber(money) >= tonumber(i*9)  then
	   		return i
	   end
	end
	return 0
end

print (test (0.9)) // execution results 0

Print (_VERSION) 5.3 // execution results Lua

// output expected result should be 0 0.1 Caidui

 

Gangster seek explain it,

Guess you like

Origin www.cnblogs.com/MYDoraemon/p/11355703.html