remainder()

Computes the remainder of x / y.

  #include <math.h>
  
  double remainder(double x, double y);
  
  float remainderf(float x, float y);
  
  long double remainder(long double x, long double y);    
Parameter

x

The dividend.

y

The divisor.

Remarks

These functions return the remainder, r, where r = x - n y, r is greater or equal to 0 and less than y, and y is non-zero.

The behavior of remainder() is independent of the rounding mode.

This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.

Listing: Example of remainder() usage

#include <math.h>

#include <stdio.h>

int main(void)

{

double var1 = 2.0;

double var2 = 4.0;

printf("remainder(%f,%f) = %f\n", var1, var2, remainder(var1,

var2));

return 0;

}

Output:

remainder(2.000000, 4.000000) = 2.000000.