What's diffirence between math.floor(x/y) and x//y?

Hi guys, I want to know, what’s diffirence between math.floor(x/y) and x//y? And if there’s none, why they both exist?
If looking to performance, x//y outweights twice:
image

Benchmark code
local start = os.clock()
for i = 1, 1000000, 1 do
    local a = math.floor(i/7)
end
print("math.floor(x/y):", os.clock()-start)
start = os.clock()
for i = 1, 1000000, 1 do
    local a = i//7
end
print("           x//y:", os.clock()-start)

There is no difference in examples you provided. They exist as separate things because they are separate things. math.floor() is used to floor any decimals, whereas // floor division operator is used to both divide AND floor at the same time.

2 Likes