3 ms·
Sadly this is not true. // is flooring division on integers, but real division on floats.
by nightcracker 10y ago
Sadly this is not true. // is flooring division on integers, but real division on floats.
- takluyver 10y agoNo, // is flooring division on floats too. It returns a float, but that float is rounded down to a whole number.
- nightcracker 10y agoI... could've sworn. I guess I'm just flat out wrong.
- squeaky-clean 10y agoJust double checked in py 3.5.0 and the double slash will do flooring division for any type. i.e. 5.0 // 4.0 returns 1.0, not 1.25.