lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Mike Pall wrote:
> r=a%b; d=(a-r)/b    |  3.76  |  0.84  |

Is LuaJIT intelligent enough to spot a % and / near each other and
optimise them into a single divide-with-remainder operation?

> Well ... maybe Lua needs a floor-division operator '//'?

It is the *one* thing that's missing from a all-numbers-are-doubles
system; all the other arithmetic operations are fundamentally the same
for both types, but division isn't.

David Given