Truncation - Truncation and Floor Function

Truncation and Floor Function

Truncation of positive integer 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.

Read more about this topic:  Truncation

Famous quotes containing the words floor and/or function:

    “Trams and dusty trees.
    Highbury bore me. Richmond and Kew
    Undid me. By Richmond I raised my knees
    Supine on the floor of a narrow canoe.”
    —T.S. (Thomas Stearns)

    The more books we read, the clearer it becomes that the true function of a writer is to produce a masterpiece and that no other task is of any consequence.
    Cyril Connolly (1903–1974)