trunc expression function

Converts a number to an integer by truncating any fractional part, rounding towards 0.

All Usage Examples

See also: int, floor, ceil, round

Usage

trunc(number)

The number is rounded toward 0. That is, for positive numbers, the largest integer less than the number will be returned. For negative numbers, the smallest integer greater than the number will be returned.

Examples

trunc(2.6)=2
trunc(-2.6)=-2