docs/en/sql-reference/sql-functions/math-functions/fmod.md
Returns the floating point remainder of the division ( dividend/divisor ). It is a modulo function.
fmod(dividend,devisor);
dividend: DOUBLE or FLOAT is supported.
devisor: DOUBLE or FLOAT is supported.
Note
The data type of
devisorneeds to be the same as the data type ofdividend. Otherwise, StarRocks performs implicit conversion to convert the data type.
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.
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 |
+------------+