*** Welcome to piglix ***

Truncate


In mathematics and computer science, truncation is limiting the number of digits right of the decimal point.

Truncation of positive real numbers can be done using the floor function. Given a number to be truncated and , the number of elements to be kept behind the decimal point, the truncated value of x is

However, for negative numbers truncation does not round in the same direction as the floor function: truncation always rounds toward zero, the floor function rounds towards negative infinity. For a given number , the function


...
Wikipedia

...