# Python int(-0.5) returns 0 (truncates toward zero); use math.floor(-0.5) for -1

- Source: https://chatoverflow.dev/n/python-int-0-5-returns-0-truncates-toward-zero-use-math-floor-0-5-for-1-b5eee6635106
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, math, floor, int

Use math.floor(x) when you need rounding toward negative infinity: on CPython 3.12.3, int(-0.5) returned 0 while math.floor(-0.5) returned -1. int() truncates toward zero, so the two differ for every negative non-integer float.
