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
🌐
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.
🌐
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 ...
Discussions

python - Round a floating-point number down to the nearest integer? - Stack Overflow
I want to take a floating-point number and round it down to the nearest integer. However, if it's not a whole, I always want to round down the variable, regardless of how close it is to the next in... More on stackoverflow.com
🌐 stackoverflow.com
How to round numbers below?
Use math.floor() to round down. https://docs.python.org/3/library/math.html#math.floor More on reddit.com
🌐 r/learnpython
7
November 29, 2024
Question: how to round In python?
You don't want to round it, you want to floor it, which lowers the number to the nearest whole. >>> import math >>> math.floor(91.66667) 91 >>> math.floor(99.9) 99 >>> math.floor(2.1) 2 More on reddit.com
🌐 r/learnpython
9
3
September 28, 2018
How would I make a python round down a number.
Import math and use math.floor() More on reddit.com
🌐 r/CodingHelp
2
1
November 13, 2020
People also ask

How do you round up or down in Python?
Use math.ceil() to round up and math.floor() to round down. These methods always move in one direction regardless of the fractional value.
🌐
blog.rteetech.com
blog.rteetech.com › home › development › how to round in python (complete guide with examples and best practices)
How to Round in Python | Complete Guide with Examples & Best Practices
What is the best way to round numbers in Python?
The best method depends on your use case. For general purposes, use round(). For financial or scientific precision, use the decimal module. For datasets, use numpy.round() or pandas.DataFrame.round().
🌐
blog.rteetech.com
blog.rteetech.com › home › development › how to round in python (complete guide with examples and best practices)
How to Round in Python | Complete Guide with Examples & Best Practices
How to round to two decimal places in Python?
Use round(number, 2). For example, round(4.6789, 2) gives 4.68. You can also use "{:.2f}".format(number) for string formatting.
🌐
blog.rteetech.com
blog.rteetech.com › home › development › how to round in python (complete guide with examples and best practices)
How to Round in Python | Complete Guide with Examples & Best Practices
🌐
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ᵖ.
🌐
RTEE Tech
blog.rteetech.com › home › development › how to round in python (complete guide with examples and best practices)
How to Round in Python | Complete Guide with Examples & Best Practices
3 weeks ago - It is also worth noting that their behavior with negative numbers is inverted relative to the number line: math.ceil(-1.5) goes up toward zero, and math.floor(-1.5) goes down away from zero. There are times when you do not want to round at all, you simply want to cut off digits beyond a certain point. This process is called truncation. Python does not have a built-in truncation function that takes a precision parameter, but you can easily create one using integer division and powers of 10.
Find elsewhere
🌐
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.
🌐
Altcademy
altcademy.com › blog › how-to-round-down-in-python
How to round down in Python
June 13, 2023 - When choosing a method for rounding ... consistent rounding down behavior for both positive and negative numbers, the math.floor() function is the best choice....
🌐
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.
🌐
Note.nkmk.me
note.nkmk.me › home › python
Round Up/Down Decimals in Python: math.floor, math.ceil
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.
🌐
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.
🌐
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.
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › floor
Python Numpy floor() - Round Down Values | Vultr Docs
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.
🌐
LabEx
labex.io › tutorials › python-how-to-round-down-a-float-to-an-integer-in-python-415546
How to round down a float to an integer in Python | LabEx
When working with floating-point numbers in Python, you may sometimes need to convert them to integers. One common operation is to round down a float to the nearest integer, which is known as "floor" or "truncation" rounding.
🌐
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 › numpy
Round up/down array elements (np.floor, np.trunc, np.ceil)
January 15, 2024 - The absolute value is obtained using np.abs(), then rounded up with np.ceil(), and the original sign is restored with np.copysign(). NumPy: Convert array elements to absolute values (np.abs, np.fabs) ... List vs. Array vs. numpy.ndarray in Python
🌐
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.
🌐
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 ·
🌐
GeeksforGeeks
geeksforgeeks.org › python › round-function-python
round() function in Python - GeeksforGeeks
In the given example, round(-3.2) is converted into -3 is the nearest integer to -3.2. Similarly, round(-4.7) returns -5 since -5 is closer to -4.7 than -4. Similarly round(-2.5) returns -2 because it rounds down when the decimal part is exactly 0.5. Same as the fourth example demonstrates using the ndigits parameter with a negative number.
Published   August 7, 2024
🌐
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.