diff between // and int(x1/x2)

whitehousechef·2024년 6월 25일

https://velog.io/@whitehousechef/%EB%B0%B1%EC%A4%80-14888%EB%B2%88

while both produces same result for + integers, it is diff for negative values. // rounds down (floor division) so -7//3 is -3. But int(x1/x2) first calculate float point of -2.333 and truncates up towards 0. So it is -2.

0개의 댓글