Yes JJ the floating number are never correct because some of them cannot be represented exactly in binary radix (they generate irrational number or irridicible fractions), but unfortunately lua has only double precision floats
.
But this problem is
well known in lua programming. Infact there are a lot of raccomandations to not use equal operator (
see), that is true also in 'C' when dealing with floats. The reason is that the language can be used in a lot of machines and compilers so you cannot expect that the floating point behavior is always the same.
To correctly program numeric comparisons in lua is to prefer 'less than' or 'greater then' instead of 'equal'.
A special case is when you expect always an integer number (the fractional part is expected to be 0) in that case you can use one of the two math functions ceil or floor.
Fuzzlix you made a very good job creating the workspace to compile lua (it works like a charm
), may I suggest to adjust project dependencies (the two executables depending on libraries) so by simply clicking 'project->rebuild workspace' the whole project compiles correctly?