All mathematical functions have the following behaviors:
- They return
NULL
if any of the input parameters isNULL
.
MOD
MOD(X, Y)
Description
Modulo function: returns the remainder of the division of X by Y. Returned value has the same sign as X.
CEIL
CEIL(X)
Description
Returns the smallest integral value (with FLOAT64 type) that is not less than X.
CEILING
CEILING(X)
Description
Synonym of CEIL(X)
FLOOR
FLOOR(X)
Description
Returns the largest integral value (with FLOAT64 type) that is not greater than X.
Example rounding function behavior
Example behavior of Cloud Dataflow SQL rounding functions:
Input "X" | CEIL(X) | FLOOR(X) |
---|---|---|
2.0 | 2.0 | 2.0 |
2.3 | 3.0 | 2.0 |
2.8 | 3.0 | 2.0 |
2.5 | 3.0 | 2.0 |
-2.3 | -2.0 | -3.0 |
-2.8 | -2.0 | -3.0 |
-2.5 | -2.0 | -3.0 |
0 | 0 | 0 |