Floor Division

Has there been any discussion of floor division similar to Python? I searched but had trouble finding anything related.

I would love to be able to 3 // 2 instead of Math.floor(3/2).

That specific syntax would be a 3 with a commented 2.

As to the overarching concept, what would it do with -4 divided by 3?

1 Like

Good point, wasn't thinking about comments here.

As far as the overarching concept, I just imagined it being syntactic sugar for Math.floor so Math.floor(-4/3) === -2.

Do want to point out that bigints have this behavior automatically.

1 Like

Dartlang has this operator as ~/