Method Name
trunc(aNumber_in)
Method Overview
The trunc function of the python math module returns only the integer part of a floating
point number.
Example
# Get only integer portion of Silver Ratio
SilverRatio = 2.4142135623
IntPart1 = math.trunc(SilverRatio)
print("Truncation of Silver Ratio resulted in: {}".format(IntPart1))
# Truncate Gelfond's constant
GelfondsConstant = 23.1406926327
IntPart2 = math.trunc(GelfondsConstant)
print("Truncation of Gelfonds Constant in: {}".format(IntPart2))Output
Truncation of Silver Ratio resulted in: 2
Truncation of Gelfonds Constant in: 23