trunc

 
 
 

Returns the whole number part of a floating point number.

float trunc(float number)

number is the number you want to truncate.

Examples

trunc(2.344)

Returns 2.

trunc(0.3)

Returns 0.

trunc(-2.82)

Returns -2.

trunc(time)

If time equals 3.1234, this returns 3.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License