int(x)

Conversion to integer will truncate (towards 0.0), like math.trunc.
For non-negative numbers, this is downward.

If your number can be negative, this will round the magnitude downward, unlike math.floor which rounds towards -Infinity, making a lower value. (Less positive or more negative).

Python integers are arbitrary precision, so even very large floats can be represented as integers. (Unlike in other languages where this idiom could fail for floats larger than the largest value for an integer type.)

Answer from Ghostwriter on Stack Overflow
🌐
W3Schools
w3schools.com › python › ref_math_floor.asp
Python math.floor() Method
The math.floor() method rounds a number DOWN to the nearest integer, if necessary, and returns the result.
🌐
Server Academy
serveracademy.com › blog › python-round-function-tutorial
Python Round() Function Tutorial - Server Academy
Python’s round() function makes it easy to round numbers to a specified number of decimal places or the nearest integer. Whether you need to round up, round down, or round to a specific decimal point, Python has you covered with its versatile round() function.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-round-numbers-up-or-down-in-python
Python Round to Int – How to Round Up or Round Down to the Nearest Whole Number
May 24, 2022 - We'll also see how to use the function's parameters to change the type of result returned to us. We'll then talk about the math.ceil() and math.floor() methods which rounds up and rounds down a number to the nearest whole number/integer respectively.
🌐
Replit
replit.com › home › discover › how to round down in python
How to round down in Python
February 6, 2026 - The math.floor() function from Python's math module is your go-to for consistently rounding down. It returns the greatest integer that is less than or equal to the input number.
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › floor
Python Numpy floor() - Round Down Values
November 14, 2024 - python Copy · import numpy as np float_num = 3.7 rounded_down = np.floor(float_num) print(rounded_down) Explain Code · The code outputs 3.0. numpy.floor() rounds down 3.7 to the nearest whole number, which is 3. Define a NumPy array with floating-point numbers.
Find elsewhere
🌐
Real Python
realpython.com › python-rounding
How to Round Numbers in Python – Real Python
December 7, 2024 - Then look at the digit d in the first decimal place of m. If d is less than 5, round m down to the nearest integer. Otherwise, round m up. Finally, shift the decimal point back p places by dividing m by 10ᵖ.
🌐
Codecademy
codecademy.com › forum_questions › 52a9f3647c82cafcc7000125
Python rounds down at .5 | Codecademy
(discalimer: I did some basic research, and this is what I got) I’d take a look here: http://stackoverflow.com/questions/6569528/python-float-to-int-conversion-problem · Basically a floating point value may not be 100% exact the way it is stored, but it knows what that floating point value is. Whenever you call int though, it truncates the value after the decimal, which results in your odd values/rounding.
🌐
FavTutor
favtutor.com › blogs › round-down-python
Round Down Numbers in Python (With Examples and Code)
September 3, 2022 - It rounds down the negative number away from zero (Here, -0.6 to 1). Python's floor division operator, aka the integer division operator, is like math.floor() method. It divides the first number by the second and then rounds down the result ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-round-numbers-in-python
How to Round Numbers in Python? - GeeksforGeeks
July 15, 2025 - Python’s built-in round() uses round half to even strategy, which rounds .5 to the nearest even number to minimize bias. If n is positive and d >= 5, round up · If n is positive and d = 5, round down ·
🌐
TradingCode
tradingcode.net › python › math › round-decimals
How to round decimal places up and down in Python? • TradingCode
To round decimal places down we use a custom function. That turns 2.348 into 2.34. Let’s look at each approach and the Python code they require.
🌐
Note.nkmk.me
note.nkmk.me › home › python
Round Up/Down Decimals in Python: math.floor, math.ceil | note.nkmk.me
January 15, 2024 - Convert a string to a number (int, float) in Python · print(int('10')) # 10 # print(int('10.123')) # ValueError: invalid literal for int() with base 10: '10.123' print(int('FF', 16)) # 255 ... Considering negative values, there are four ways to round up and down.
🌐
Altcademy
altcademy.com › blog › how-to-round-down-in-python
How to round down in Python - Altcademy.com
June 13, 2023 - Another method for rounding down numbers in Python is by using the built-in int() function. The int() function takes a number as its input and returns the integer portion of the number, effectively rounding down the number.
🌐
Mimo
mimo.org › glossary › python › round-function
Python round(): Rounding Numbers in Python
Using a negative value for the ndigits parameter, the round() function can round a floating-point number or integer to a multiple of 10. In the following example, we round 12345 to the nearest hundred (12300), simplifying the value. ... Python’s round() function works well in many cases.
🌐
DataCamp
datacamp.com › tutorial › python-round-up
How to Round Up a Number in Python | DataCamp
July 22, 2024 - Rounding a number involves adjusting ... If you want to round down instead of rounding up in Python, you can use the math.floor() function....
🌐
Python Pool
pythonpool.com › home › blog › best ways to round down numbers in python
Best Ways to Round Down Numbers in Python - Python Pool
January 1, 2024 - As you can see, using the numpy.floor() method, we were able to round down the elements of a given array. // is the floor division operator of Python.
🌐
Inspector
inspector.dev › home › round up numbers to integer in python – fast tips
Round Up Numbers to Integer in Python - Inspector.dev
June 17, 2025 - The math library in Python provides the ceil() and floor() functions to round numbers up and down, respectively, to the nearest integer. These functions are useful when you need to work with integer values, especially in cases like calculating ...
🌐
W3Schools
w3schools.com › python › ref_func_round.asp
Python round() Function
Python Examples Python Compiler ... Python Training ... The round() function returns a floating point number that is a rounded version of the specified number, with the specified number of decimals....
🌐
Vultr Docs
docs.vultr.com › python › built-in › round
Python round() - Round Numeric Value | Vultr Docs
November 27, 2024 - This example rounds 9.87654 to 9.877. Specifying 3 as the second argument rounds the number to three decimal places. Understand that Python uses the rounding half to even strategy.