The math.trunc()
function is used to truncate a number to its integer part. It simply removes the decimal part of the given number, returning the integer.
math.trunc(x)
Where, parameter x
is the number to be truncated.
If the input is a float (decimal) number, the math.trunc()
function removes the digits after the decimal point and returns the integer. If the input is an integer, the function simply returns the same integer.