Integer modulus operator %
is handy in computing the remainder of the division operation x/y
. However, there is no built-in
operator for floating-point (double
or float
) modulus operation.
Fortunately, there is a fmod( float x, float y)
function implemented in the C/C++ standard library <math.h>
: