The ROUNDDOWN function rounds a real number to a maximum number of decimal places towards zero.
ROUNDDOWN(
number,
num_digits
)
- number: Real number to round.
- num_digits: Number of decimal digits to round to.
The ROUNDDOWN function returns a real number.
The ROUNDDOWN function behaves similarly to ROUND, except that ROUND always rounds towards -infinite (not towards zero). The INT function also rounds a number toward -infinity, but always returns an integer.
If num_digits is a number greater than zero, number is rounded to zero to the number of decimal places indicated by num_digits. If it is zero, therefore, the result will be the closest integer towards zero. Finally, if num_digits is a negative value, number is rounded to the left of the decimal point (see an example below).
When viewing the result of this function, it is important to ensure that the format of the field or measure (configurable in the Column tools or Measure tools tab) is not modifying its appearance on the canvas.
This example rounds a positive and a negative number to a variable number of digits:
The behavior of the different rounding functions is summarized below:
- ROUNDDOWN: Rounds a number towards zero and the number of decimal places can be specified.
- ROUNDUP: Rounds a number away from zero and the number of decimal places can be specified.
- ROUND: Rounds a number towards the nearest rounding value and the number of decimal places can be specified.
- INT: Rounds a number to the nearest equal or lower integer.
- TRUNC: Rounds a number towards its integer part and the number of decimal places can be specified.
Examples: