fmod
Returns the floating point remainder of the division ( dividend
/divisor
). It is a modulo function.
Syntaxβ
fmod(dividend,devisor);
Parametersβ
-
dividend
: DOUBLE or FLOAT is supported. -
devisor
: DOUBLE or FLOAT is supported.
Note
The data type of
devisor
needs to be the same as the data type ofdividend
. Otherwise, StarRocks performs implicit conversion to convert the data type.
Return valueβ
The data type and sign of output need to be the same as the data type and sign of dividend
. If divisor
is 0
, NULL
is returned.
Examplesβ
mysql> select fmod(3.14,3.14);
+------------------+
| fmod(3.14, 3.14) |
+------------------+
| 0 |
+------------------+
mysql> select fmod(11.5,3);
+---------------+
| fmod(11.5, 3) |
+---------------+
| 2.5 |
+---------------+
mysql> select fmod(3,6);
+------------+
| fmod(3, 6) |
+------------+
| 3 |
+------------+
mysql> select fmod(3,0);
+------------+
| fmod(3, 0) |
+------------+
| NULL |
+------------+