Skip to main content

FMOD

Description

Calculate the modulo of floating-point numbers, a / b. For integer types, please use the mod function.

Syntax

FMOD(<col_a> , <col_b>)

Parameters

ParameterDescription
<col_a>Dividend
<col_b>Divisor (cannot be 0)

Return Value

Returns a floating-point number. Special cases:

  • When any input parameter is NULL, returns NULL.

Examples

select fmod(10.1, 3.2);
+-----------------+
| fmod(10.1, 3.2) |
+-----------------+
| 0.50000024 |
+-----------------+
select fmod(10.1, 0);
+---------------+
| fmod(10.1, 0) |
+---------------+
| NULL |
+---------------+
select fmod(10.1, NULL);
+------------------+
| fmod(10.1, NULL) |
+------------------+
| NULL |
+------------------+