EXAMPLE - Rounding Functions
This example demonstrates how the rounding functions work together.
Functions:
Item | Description |
---|---|
FLOOR Function | Computes the largest integer that is not more than the input value. Input can be an Integer, a Decimal, a column reference, or an expression. |
CEILING Function | Computes the ceiling of a value, which is the smallest integer that is greater than the input value. Input can be an Integer, a Decimal, a column reference, or an expression. |
ROUND Function | Rounds input value to the nearest integer. Input can be an Integer, a Decimal, a column reference, or an expression. Optional second argument can be used to specify the number of digits to which to round. |
MOD Function | Returns the modulo value, which is the remainder of dividing the first argument by the second argument. Equivalent to the |
Source:
rowNum | X |
---|---|
1 | -2.5 |
2 | -1.2 |
3 | 0 |
4 | 1 |
5 | 1.5 |
6 | 2.5 |
7 | 3.9 |
8 | 4 |
9 | 4.1 |
10 | 11 |
Transformation:
Transformation Name |
|
---|---|
Parameter: Formula type | Single row formula |
Parameter: Formula | FLOOR(X) |
Parameter: New column name | 'floorX' |
Transformation Name |
|
---|---|
Parameter: Formula type | Single row formula |
Parameter: Formula | CEILING(X) |
Parameter: New column name | 'ceilingX' |
Transformation Name |
|
---|---|
Parameter: Formula type | Single row formula |
Parameter: Formula | ROUND (X) |
Parameter: New column name | 'roundX' |
Transformation Name |
|
---|---|
Parameter: Formula type | Single row formula |
Parameter: Formula | (X % 2) |
Parameter: New column name | 'modX' |
Results:
rowNum | X | modX | roundX | ceilingX | floorX |
---|---|---|---|---|---|
1 | -2.5 | -2 | -2 | -3 | |
2 | -1.2 | -1 | -1 | -2 | |
3 | 0 | 0 | 0 | 0 | 0 |
4 | 1 | 1 | 1 | 1 | 1 |
5 | 1.5 | 2 | 2 | 1 | |
6 | 2.5 | 3 | 3 | 2 | |
7 | 3.9 | 4 | 4 | 3 | |
8 | 4 | 0 | 4 | 4 | 4 |
9 | 4.1 | 4 | 5 | 4 | |
10 | 11 | 1 | 11 | 11 | 11 |