11 ms·
because it's a float and not an int, it's strictly talking about integers here, not floats. All int conversions of floats are converted by discarding the remain
by consp 3y ago
because it's a float and not an int, it's strictly talking about integers here, not floats. All int conversions of floats are converted by discarding the remainder afaik but I could be wrong here (e.g. int(1.9) == 1, and int(-1.9) == -1)
edit: -3//2 == -2 for instance, since it's strictly integer division
- cygx 3y agoIt's a valid criticism: By the principle of least surprise, one should strive for a//b = int(a/b). Basically, there's no free lunch. Personally, I prefer truncating integer division in combination with a pair of remainder operators.
- odyssey7 3y agoInspired by Monty Python, the surprises are part of the charm. ¯\_(ツ)_/¯