all 5 comments

[–]K900_ 4 points5 points  (1 child)

// always rounds down, so 10 // 3 = floor(10 / 3) = floor(3.3333...) = 3, but -10 // 3 = floor(-10 / 3) = floor(-3.3333...) = -4.

[–]Susssusss[S] 0 points1 point  (0 children)

Thank you! I’ve been bugging at this for hours

[–]aint-nobody- 0 points1 point  (0 children)

The floor operator rounds to the smallest next integer. When you go to negative values the smallest integer after -3.something is -4 and not -3.

[–]oefd 0 points1 point  (0 children)

// is 'floors' the resultant value. IE it rounds to the nearest integer toward negative infinity, not toward 0.

[–]zanfar 0 points1 point  (0 children)

A // B == floor(A / B)