Talk:Lua Programming/Statements

In the Count-controlled loops section, the last example statement does not break at 1.5 [expected behavior] but instead increments up to 1.9 when run in codepad, Lua.org's demo code engine, or ZeroBrane. Any idea why?

The example statement:

Note that changing "if n == 1.5 then" to "if n >= 1.5 then" OR changing "for n = 1, 2, 0.1 do" to "for n = 1, 1.6, 0.1 do" results in the expected behavior. -- User:173.165.135.213
 * Seems like floating point precision has striken again. Thank you for noticing this. I have fixed the example and added an explanation of the problem. -- Mark Otaris (discuss • contribs) 01:05, 26 August 2013 (UTC)