Computes a remainder after division.
#include <math.h> double fmod(double x, double y); float fmodf(float x, float y); long double fmodl(long double x, long double y);
x
The dividend.
y
The divisor.
These functions return, when possible, the value r, where x = i y + r for some integer i that allows |r | < |y|. The sign of r matches the sign of x.
This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.
#include <math.h> #include <stdio.h> int main(void) { double x = -54.4, y = 10.0; printf("Remainder of %f / %f = %f.\n", x, y, fmod(x, y)); return 0; } Output: Remainder of -54.400000 / 10.000000 = -4.400000.