no, it’s not really an optimization device. use floor division (//) when you want floor(a/b) and use division (/) when you want a/b. standard division always returns a float even if the operands are both integer, and vice versa for floor division.
How can I check the implementation
look at the lua source
this tells us, if the operands are both int, luaV_div is called, otherwise you get some macros, after which unwrapping are simply the C expression floor(a/b)
or test run speeds?
check system time, perform many calculations, check time again.
but my advice is to not waste your time with this. lua is fast for a scripting language but it’s not C or ASM. each operation in lua involves many processor instructions as it performs type checking, handles edge cases &c. the actual arithmetic is going to be done in a single instruction and is relatively insignificant. if you need to rapidly perform thousands or millions of calculations then maybe doing it in lua is not the way to go.