This is a well known phenomenon. Remember, at the end of the day, these values are stored in a binary encoded format and there will be precision and rounding issues based on the number of bits available for the exponent and mantissa.
https://www.doc.ic.ac.uk/~eedwards/compsys/float/
http://floating-point-gui.de/formats/fp/
http://floating-point-gui.de/errors/comparison/
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
To solve this, simply apply floor, ceil, or your own rounding :
For your specific example, this fixes the problem:
local function round(val, n) if (n) then return math.floor( (val \* 10^n) + 0.5) / (10^n) else return math.floor(val+0.5) end end local number1 = (100 + 1/3) - 100 local number2 = 1/3 print("1 values:", number1, number2) if number1 == number2 then print("1 they are the same") else print("1 nope") end local number1 = round((100 + 1/3) - 100,14) local number2 = round(1/3,14) print("2 values:", number1, number2) if number1 == number2 then print("2 they are the same") else print("2 nope") end